daml/language-support/hs/bindings
2019-08-28 15:37:12 +00:00
..
examples hlb, remove dependency on DAML-LF libs (#2650) 2019-08-23 18:00:58 +01:00
src/DA hlb, remove dependency on DAML-LF libs (#2650) 2019-08-23 18:00:58 +01:00
test hlb, remove dependency on DAML-LF libs (#2650) 2019-08-23 18:00:58 +01:00
build_packages.sh Various improvements to make hs-bindings usable outside repo (#2583) 2019-08-19 16:44:45 +00:00
BUILD.bazel Mark Haskell ledger bindings tests flaky on all platforms (#2692) 2019-08-28 15:37:12 +00:00
daml-ledger.cabal Supporting producing sdist tarballs for the HS ledger bindings (#2336) 2019-07-30 14:34:16 +02:00
README.md hs-bindings readme: fix link (#2349) 2019-07-31 14:22:01 +01:00

Usage

There is currently no separate documentation for the haskell ledger bindings, over and above the existing ledger API doc.

The .proto files are the best primary source of truth for the API. The Haskell bindings match closely the names of the services and RPCs, but of course you get much better types.

The entry point is at DA.Ledger.

To use the bindings in this repo, you need the following BUILD dep:

"//language-support/hs/bindings:hs-ledger",

And then you can import the DA.Ledger module in your Haskell code.

You can find some usage examples here and here.

Using these bindings outside of this repository can be a bit tricky since there are quite a few packages required that are not published to Hackage at the moment.

To make things a bit easier there is a build_packages.sh script in this directory that you can run as follows: ./build_packages.sh TARGET_DIR. This will build the tarballs for all cabal packages and put them in TARGET_DIR. If TARGET_DIR does not already contain a cabal.project file, it will also create a cabal.project file that references the created tarballs so all dependencies should be resolved properly. You will also need to install gRPC 1.22, see https://github.com/grpc/grpc/blob/master/BUILDING.md for installation instructions. If you install it in a non-standard location, you need to adjust extra-lib-dirs and extra-include-dirs for grpc-haskell-core. The default cabal.project file contains an example of how to do this.

The main package for the ledger bindings is called daml-ledger.