Astrocoders / Lenses Ppx
Licence: mit
PPX to derive GADT lenses for ReasonML
Stars: ✭ 85
Labels
Projects that are alternatives of or similar to Lenses Ppx
Recontainers
[DEPRECATED] ReasonReact utilitary high order components
Stars: ✭ 54 (-36.47%)
Mutual labels: reasonml
Revery Terminal
Barebones terminal emulator built with ReasonML + Revery + libvterm
Stars: ✭ 76 (-10.59%)
Mutual labels: reasonml
React Rules Of Hooks Ppx
This ppx validates the rules of React hooks.
Stars: ✭ 34 (-60%)
Mutual labels: reasonml
Rollup Plugin Bucklescript
rollup plugin for using bucklescript
Stars: ✭ 23 (-72.94%)
Mutual labels: reasonml
Reason App Shell Starter Kit
A simple App Shell starter kit that you can use to get started building your PWA with ReasonML & ReasonReact.
Stars: ✭ 49 (-42.35%)
Mutual labels: reasonml
Restyled
Styled Components concept for Reason React, only works with bs-react-native for now
Stars: ✭ 68 (-20%)
Mutual labels: reasonml
Revery
⚡ Native, high-performance, cross-platform desktop apps - built with Reason!
Stars: ✭ 7,812 (+9090.59%)
Mutual labels: reasonml
Pragma
Pragma is a self-hosted, open-source, personal note taking app.
Stars: ✭ 39 (-54.12%)
Mutual labels: reasonml
One Punch Fitness
A "One Punch Man"-inspired workout app!
Stars: ✭ 64 (-24.71%)
Mutual labels: reasonml
Bs React Intl Extractor
Extracts messages for localization from Reason source files.
Stars: ✭ 27 (-68.24%)
Mutual labels: reasonml
Rescript React Update
useReducer with updates and side effects!
Stars: ✭ 79 (-7.06%)
Mutual labels: reasonml
Revery Playground
Live, interactive playground for Revery examples
Stars: ✭ 14 (-83.53%)
Mutual labels: reasonml
Gitlab Search
Command line tool to search for contents in GitLab repositories
Stars: ✭ 60 (-29.41%)
Mutual labels: reasonml
Introduce Reason Example
An example app made with Create React App which introduces a Reason component
Stars: ✭ 82 (-3.53%)
Mutual labels: reasonml
Reenv
dotenv-cli implementation in native ReasonML providing near-instant startup times
Stars: ✭ 65 (-23.53%)
Mutual labels: reasonml
What are GADTs?
Install
Install the last stable version
For BuckleScript < 6
npm install --save-dev [email protected]
or
yarn add [email protected] -D
For BuckleScript >= 6
npm install --save-dev [email protected]
or
yarn add [email protected] -D
Build
npm run build
Watch
npm run watch
In
module StateLenses = [%lenses
type state = {
email: string,
age: int,
}
]
Out
module StateLenses = {
type state = {
email: string,
age: int,
};
type field(_) =
| Email: field(string)
| Age: field(int);
let get: type value. (state, field(value)) => value =
(state, field) =>
switch (field) {
| Email => state.email
| Age => state.age
};
let set: type value. (state, field(value), value) => state =
(state, field, value) =>
switch (field) {
| Email => {...state, email: value}
| Age => {...state, age: value}
};
};
Using
open StateLenses;
let state = {email: "[email protected]", age: 969};
Js.log(state->get(Email));
Js.log(state->get(Age));
Alternatively you can also use it like
[@lenses]
[@decco]
type bartux = {
color: string,
top: int,
};
let bartux = {color: "red", top: 10};
Js.log(bartux->bartux_get(Color));
Js.log(bartux->bartux_set(Top, 20));
Js.log(bartux_encode(bartux));
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].