-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add an example on how to use lenses #22
Comments
lenses are only generated if you prefix your fields with _, just like in haskell. So your record should be: _author :: Author and the lens access:
|
So, I have to use lenses with haskell if I want to use them with purescript? |
Actually no, but yes the intention is to have a more seamless translation. If you had lenses in Haskell you have them in PureScript too. No because you don't have to have lenses in haskell, all you need is to prefix your field names with an underscore. Alternatively if you really want lenses and prefixes in PS but not in Haskell you can add the prefixes by providing your own custom bridge. |
what do you mean by "providing your own custom bridge"? |
Hehe, sorry that suggestion did not receive too much thought ;-) You are right, you can't change record field names by means of a custom bridge, as bridges only translate types. If you want something like this, you would need to modify the Simply modify the I hope that helps! |
Thanks! |
Here is an example using purescript-bridge/example/src/Main.purs Lines 48 to 51 in b025797
|
I can't get how to use the lenses generated by
purescript-bridge
...Let's suppose I have the following haskell types defined:
given a purescript
Book
:How can I access to the number of pages, and the author name?
I would expect something like this:
but it does not seem to work...
The text was updated successfully, but these errors were encountered: