haskell-grpc-native / http2-grpc-haskell

gRPC over HTTP/2 for Haskell, client and server
39 stars 24 forks source link

haskell-grpc-native

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 this three ideas:

Usage

We will soon provide examples in this repository. We are currently migrating repositories from scattered places into this organization.

Using proto-lens

First, you'll need both protoc and proto-lens-protoc installed.

In short protoc is a protobuf compiler which calls to external program (in our case proto-lens-protoc) to generate an output (in our case, Haskell code that is part of a library). This process is depicted in the following picture.

build with proto-lens

Note that the version of proto-lens-protoc will determine the version of proto-lens-runtime that you need to import in your project.

Recommendation: you can share the generated-code between server and clients. Hence, we propose to bundle all generated Haskell code in one library that depends on proto-lens-runtime as one types package. Then import this types package in your client/server applications.

Using proto3-wire

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.