Giter VIP home page Giter VIP logo

lenses-ppx's People

Contributors

actions-user avatar anmonteiro avatar baransu avatar elnygren avatar fakenickels avatar romanschejbal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lenses-ppx's Issues

Building Ppx.exe

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.

bsb -make-world + lenses-ppx fails in bs-platform 6.x

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'

install fails due to `"ppx-flags": ["./ppx"]`

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

  1. install the 1.0.1 version of this library
  2. update it to head of master
    => rock n roll

However, trying to install master directly will fail.

Add support for Windows

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!

Build failure w/ ReScript v9

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'

Inspired by #10

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.

Consider adding a way to get/list all the fields and iterate them ?

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?

A warning is triggered when defining StateLenses with a single field

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.

[Help] GLIBC_2.27 not found

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

Update GitHub Actions user commit

​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)

Takes ages to install

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?

Fail to run demo

What I have done:

  • run esy in /packages
  • run yarn install in demo
  • spin up bs platform by yarn run watch

and the bs compiler complained: Fatal error: exception Failure("Ast_mapper: OCaml version mismatch or malformed input")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.