astrocoders / lenses-ppx Goto Github PK
View Code? Open in Web Editor NEWGADT lenses
License: MIT License
GADT lenses
License: MIT License
I'm trying to understand how to build a ppx with melange. I can't seem to build the ppx dir using any of the commands in esy.json
or package.json
. Is it possible to share the build steps?
The only output in _build/
that I get is:
# dune upgrade
# OCAMLPARAM: unset
# Workspace root: /Users/mando/Github/lenses-ppx/packages/ppx
$ /usr/bin/getconf _NPROCESSORS_ONLN > /var/folders/jk/x59dhv6s7151k4mfmshf6v480000gn/T/dunecc4f07.output 2> /dev/null
# Auto-detected concurrency: 8
Thanks for teaching.
Getting compiler errors after upgrading to bs-platform 6.x
OCaml version mismatch or malformed input.
Error:
FAILED: src/Company/utils/CompanyApi.reast
/Users/project/node_modules/bs-platform/lib/bsc.exe -w -30-40+6+7+27+32..39+44+45+101 -warn-error +101 -color always -bs-jsx 3 -ppx /Users/project/node_modules/lenses-ppx/ppx -bs-g -o src/Company/utils/CompanyApi.reast -bs-syntax-only -bs-binary-ast /Users/project/src/Company/utils/CompanyApi.re
Fatal error: exception Failure("Ast_mapper: OCaml version mismatch or malformed input")
We've found a bug for you!
/Users/project/src/Company/utils/CompanyApi.re
Error while running external preprocessor
Command line: /Users/project/node_modules/lenses-ppx/ppx '/var/folders/n5/z1pnr9sj2ts5zy3692rl8bhm0000gn/T/camlppx170352' '/var/folders/n5/z1pnr9sj2ts5zy3692rl8bhm0000gn/T/camlppx5da3dd'
Hi guys! Thanks for making this ppx and the Reforms library :)
I noticed a small issue in installing the latest master of lenses-ppx.
[1/2] Building src/LensesPpx.mlast
sh: <...path...>/lenses-ppx/./ppx: No such file or directory
Something that does work
However, trying to install master directly will fail.
[@lenses]
type state = {
email: string
}
As far as I understand the configured workflow, it does not build a binary for Windows. We do have a team member with a Windows laptop thus we need to support that platform. I'm happy to help set this up (although I'm very new to the Github Actions) or test. Thanks!
Use the ppx helper functions to generate the tree instead of the huge verbose tree we are using now
Build failed w/ ReScript v9.1.2
$ npx rescript build -w
rescript: [1/43] src/App.ast
FAILED: src/App.ast
Fatal error: exception Failure("Ast_mapper: OCaml version mismatch or malformed input")
We've found a bug for you!
/Users/woonki/Documents/works/gl/sources/sinsun-market/client/src/App.res
Error while running external preprocessor
Command line: /Users/woonki/Documents/works/gl/sources/sinsun-market/client/node_modules/lenses-ppx/ppx '/var/folders/mw/t4sy4tnj5gs_zplj8xdp62_w0000gn/T/ppx0b7bb9App.res' '/var/folders/mw/t4sy4tnj5gs_zplj8xdp62_w0000gn/T/ppxb1e5daApp.res'
What about generating Prisms, Traversals, or other optics? I'm also curious about how these compose... I've got some heavy enough usage of nested |> Option.map(x => x.prop)
and |> Option.flatMap(x => x.prop)
stuff, and I'm wondering if making use of this library might give me some better ergonomics.
Sometimes when working with forms one might want to loop over all the fields and render any errors they have.
Perhaps this library could generate some kind utilities for this in addition to getters&setters of individual fields?
For example maybe I'd like to do this in onSubmitFail
of reforms:
/** Handle failures detecred *before* onSubmit (mutation call).ShiftsListGraphQL
Useful for displaying errors from local validations of ShiftForm. */
let onSubmitFail = ({state}: ShiftForm.onSubmitAPI) => {
Js.log4("onSubmitFail", state.values, state.formState, state.fieldsState)
let collectErrorString = field =>
ShiftForm.getFieldState(~schema, ~values=state.values, ~field)
->Belt.Option.map((_, fieldState) =>
switch (fieldState) {
| ShiftForm.Error(s) => Some(s)
| _ => None
}
);
// build these into Js.Dict along their errors to render something to the user
// eg; "there are errors in these fields"
collectErrorString(Field(Name))
collectErrorString(Field(BrandId))
collectErrorString(Field(Is_draft))
collectErrorString(Field(ShiftId))
collectErrorString(Field(Shift_visibility))
collectErrorString(Field(Contract_type))
collectErrorString(Field(Matchmaking_industry))
collectErrorString(Field(Matchmaking_category))
collectErrorString(Field(Name))
collectErrorString(Field(Description))
collectErrorString(Field(LocationId))
collectErrorString(Field(Custom_address))
collectErrorString(Field(Languages))
collectErrorString(Field(Requirements))
collectErrorString(Field(Cover_photo))
collectErrorString(Field(Schedule_type))
collectErrorString(Field(Pricing_type))
collectErrorString(Field(Rate_hourly_amount))
collectErrorString(Field(Rate_fixed_amount))
collectErrorString(Field(Times))
collectErrorString(Field(Cnt))
};
however, the code can get quite tedious quite fast with larger forms.
Or maybe I should be approaching this problem differently?
Here's an example:
module StateLenses = [%lenses type state = { isChecked: bool }];
The warning will be:
Warning number 23
(No file name)
All the fields are already explicitly listed in this record. You can remove the `...` spread.
It's not obvious where the problem is until you check the code generated by PPX where spread is used in the generated setter.
Hello,
I upgrade to the latest version of lenses-ppx and everything works fine except on the Gitlab CI, I got this error :
/node_modules/lenses-ppx/ppx: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found
I'm using node:lts
Is this esy related ?
Thanks
βThe recommended styles is:
git config --global user.email "[email protected]"
git config --global user.name "github-actions[bot]"
Alternatively, if you want the actor to be the committer, you can do the following:
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
Originally posted by @smorimoto in #31 (comment)
On my laptop, with a decent internet connection speed, installation takes up to 25 minutes, and sometimes fails (with npm
, it seems it works with yarn
).
Most of the installation time is due to bsb-native
takings ages to download.
I assume bsb-native
is used to build ppx-lense
, but it seems it's not a viable solution. Would you consider releasing on npm the compiled binaries instead?
What I have done:
esy
in /packages
yarn install
in demoyarn run watch
and the bs compiler complained: Fatal error: exception Failure("Ast_mapper: OCaml version mismatch or malformed input")
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.