This is a code-generated wrapper for @mlabs-haskell/cardano-serialization-lib-gc
, a vendored version of CSL by Emurgo.
Most likely you would want to use purescript-cardano-types
- that library provides a nice purely-functional interface on top of these raw bindings.
purescript-cardano-serialization-lib
is almost unusable on its own, e.g. see #11.
Library ports the CSL api. The JS classes are converted to values of record type which define interface for a given class. The value contains both static and object methods. For object methods the self argument always goes first.
For example if we want to create BigNum
from string in JS we can write:
Csl.BigNum.from_str("100200");
In purescript it is called on the value bigInt
which provides the function:
import Cardano.Serialization.Lib as CSL
CSL.bigNum_fromStr "100200"
To use this library you whould also add @mlabs-haskell/cardano-serialization-lib-gc
as external dependency. Provide this library with your JS code package manager
and also compile the purs code with it as external dep.
Usage example: purescript-cardano-types
.
Code is auto generated from CSL API. Alas for some functions it's not possible to tell is it pure or dirty. Submit an issue if you have found an effectful function which is declared like pure and vise versa.
See the code-gen
directory for the source code of the code parser and generator.
- Run the haskell binary:
cd code-gen/parse-csl
make run # assumes haskell stack is installed
- Copy the output
make copy # run in the project root
- Apply formatting
make format # run in the project root
./code-gen/parse-csl/fixtures
contains some fixture files that the haskell binary reads./code-gen/parse-csl/data
contains type definitions for CSL, based on which the PS code is generated./code-gen/parse-csl/output
is where the generated files appear, from where they can be copied tosrc/