purescript-bridge
purescript-bridge copied to clipboard
Create PureScript datatypes from Haskell datatypes
purescript-bridge
Translate your Haskell types to PureScript types. It should in theory work for almost all Haskell types, including type constructors! You just have to instantiate it with dummy parameters from e.g. "Language.PureScript.Bridge.TypeParameters".
Data type translation is fully and easily customizable by providing your own BridgePart instances!
The latest version of this project requires Purescript 0.15.
JSON encoding / decoding
For compatible JSON representations:
- On Haskell side:
- Use
aeson's generic encoding/decoding with default options
- Use
- On Purescript side:
- Use
purescript-argonaut-aeson-generic >=0.4.1(GitHub) - Or use
purescript-foreign-generic.- This branch is updated for Purescript 0.15.
- Use
Documentation
Usage of this library is documented in Language.Purescript.Bridge, with writePSTypes you should have everything to get started. Documentation can be found here.
Status
It works for my use case and is used in production. PRs for more PSTypes definitions and bridges are very welcome!
Contributing
Formatting the source code
This repo uses stylish-haskell. .stylish-haskell.yaml is provided.
find . -name '*.hs' | xargs stylish-haskell -i