Typedefs
JS version ofGenerated from ParserJS.idr
.
- Published on npm as
typedefs-js
, to install for Node run,npm install -s typedefs-js
- It is also available for the browser using the unpkg CDN, use the following magic HTML incantation.
Usage example
For node
let generateType generateTermSerializers = let haskellCode = console
In the browser
API
generateType : String -> String -> Either String String
Generate the type definitions in the target language the given typedef as a string.
The first argument to this function is the backend name as a string:
haskell
reasonml
json
(only supports closed typedefs)
The second argument is the typedef string.
Errors are returned as a string on the Left
value of the either as is customary.
generateTermSerializers : String -> String -> Either String String
Generate code in the target language that serialize and deserialize the given typedef as a string.
The first argument to this function is the backend name as a string:
haskell
reasonml
json
(only supports closed typedefs)
The second argument is the typedef string.
Errors are returned as a string on the Left
value of the either as is customary.
Publishing an update to npm
Be sure to bump the version in package.json
. Then also run npm i
to rebuild and update the package-lock.json
, then commit and push and CI should publish the build to npm.