Haskell Query API
To use the Haskell API:
import Glean
import Glean.Angle
Or import qualified if you prefer:
import qualified Glean
import qualified Glean.Angle as Angle
- Haskell query API
- Angle DSL - a library for building type-safe Angle queries
- Simple example client
- Example: Hyperlink: browse hyperlinked code
- Example: Search for definitions by name
Using Haxlβ
Glean comes with a Haxl API for performing queries. The advantages of using the Haxl API are:
Queries can be performed concurrently without using explicit threads or
Control.Concurrent.Async
. Applicative combinators such assequence
ormapM
are performed concurrently in theHaxl
monad, and GHC'sApplicativeDo
extension can be used to enable implicit concurrency within a sequence of statements in ado
expression.When traversing the results of a query, instead of using the
recursive
query modifier to recursively fetch the entire result, Haxl provides a family ofget
operations to iteratively fetch nested facts in the result. When performed concurrently in theHaxl
monad, multiple calls toget
are batched into a single request to Glean. This makes it efficient to do shallow queries and then selectively traverse and expand the results as needed.
To use the API, import Glean.Haxl. The implementation of the API is in glean/haxl/Haxl/DataSource/Glean.hs.