Skip to content

jamesthompson/http2-grpc-haskell

 
 

Repository files navigation

http2-grpc-haskell

This organization and repository aim at providing unofficial gRPC implementations for Haskell using native libraries.

Context

Haskell is not an officially supported gRPC language. This repository offers a set of libraries that are compatible with gRPC. A main goal of this initiative is that an intermediate Haskell developper should find the packages reasonably easy to install and easy to tinker with.

Repo organization

The code is split in a number of packages following these three ideas:

  • share a common types packages
  • have server and client-specific packages
  • add a serialization-library specific packages

Bazel for building

Drop inside a nix-shell to utilize bazel with all of the necessary (macOS and/or linux) build tooling.

GHC will be provisioned by nix in the bazel workspace bootstrapping.

Bazel targets can be listed with:

bazel query //...

Current build targets of interest include:

you can build all the targets, which cold should take on the order of 5 mins or so, with:

bazel build //...

drop into an individual target GHCi repl session thus (for example):

bazel run //http2-client-grpc:http2_client_grpc@repl

Usage

A basic example end-to-end setup is given in the examples package.

In here you can find a proto spec for a basic unary gRPC method, along with client and server libraries making use of generated haskell proto-lens code.

Specified in the examples BUILD file, you can find a binary demonstrating these library's usage in the build target example_grpc_bin.

You can run the binary from the nix-shell (which requires PORT=3000 on the localhost interface to be free) with:

bazel run //examples:example_grpc_bin

Alternatives

There is a low-level API in the official gRPC repository. There also is a more-complete API which uses a binding to the C-library and which is supported by AwakeSecurity.

About

gRPC over HTTP/2 for Haskell, client and server

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 82.1%
  • Starlark 16.2%
  • Nix 1.7%