A tool to keep you types in syncs across your stack
TODO
- You need
stack
installed - You can run the test suite with
stack test
- Please add a spec file and write tests, you can look to the test suite in
tests/
to look at an example
A tool to keep you types in syncs across your stack
License: BSD 3-Clause "New" or "Revised" License
A tool to keep you types in syncs across your stack
TODO
stack
installedstack test
tests/
to look at an exampleThe options that are (currently) being discussed are:
I'm kind of excited at the possibility of using Haskell, but is has a pretty major drawback: we'd need to cross-compiling in order to publish to multiple platforms. This doesn't looks super challenging, and the steps are outlined here: (derived from elm-platform)
Reason would be super cool as well! Since it can be compiled to JS, it can be run using Node to avoid the cross-platform issue mentioned above. We will probably need to use Reason-JS interop to have access to the JS ecosystem, since I'm not sure how many thing will be written in native Reason (such as a YAML parser or something).
Not sure how using Elm would work, but I imagine we could somehow bootstrap it with Reason or something to take in cli arguments and apply them to an Elm program, similar to how elm-typescript-interop does with typescript.
Overall all of these languages are great, and I'm psyched on which ever we choose.
This is a continuation of https://discourse.elm-lang.org/t/generating-border-types/722
Basically we are not sure if we want to generate types from format (YAML, JSON, etc) that defines them, or generate them from an Elm program that exposes ports.
My preference is using something like YAML or JSON, for a few reason:
I need to do more learning about how to generate the types in Elm and the host languages, and what approaches exist. I'm assuming we'd use ASTs. To my understanding, it is basically a parser and programmatic representation of a programming language data.
Elm ASTs:
Typescript ASTs:
Reason ASTs:
How should the type definition config file look?
From https://www.notion.so/A-script-to-generate-both-Reason-and-Elm-types-for-ports-5177b1c921c74d55a05be797ef4a43bf but in JSON
{
"<type-name>": {
"<constructor-name1>": {
"<field-name1>": "<field-type>"
},
"<constructor-name2>": {
"<field-name2>": "<field-type>"
},
}
}
Would translate to:
-- ELM
type <type-name>
= <constructor-name1> {<field-name1> : <field-type>}
| <constructor-name2> {<field-name2> : <field-type>}
// REASON
type <type-name> =
| <constructor-name1>({. "<field-name1>": <field-type>})
| <constructor-name2>({. "<field-name2>": <field-type>})
This is all fine and good, however there are a few things that this does not address:
a) Defining a top-level type alias (and the how to differentiate between unions & aliases)
b) Defining arguments on union types that are not records
c) Defining a top-level type OR type alias, and reference it later
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.