question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi,

I am using lenses extensively and I am defining all data focusers as lenses. Problem is when I want to use functions like pathEq. These functions are not designed to work with lenses. I can overcome this limitation with simple shortcut

const value = view(lens, object);
console.dir(value === exptected)

or with composition

flow(
  view(lens, object),
  eq(exptected)
)()

But this doesn’t seem quite right. I am inclined to create my own util lensEq with this signature

lensEq :: Lens -> Any(exected) -> Any(focused object) -> Boolean

I am just wondering, am I missing something in ramda ? If not, is lensPath the right direction to go ?

Thank you very much

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
buzzdecafecommented, Sep 22, 2017

cookbook sounds good to me!

1reaction
char0ncommented, Feb 1, 2017

@CrossEye I have added the link of the article to ramda Wiki homepage (title: Composing lenses in Ramda). I will also submit a recipe for lens composition in a couple of days.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ramda Documentation
A special placeholder value used to specify "gaps" within curried functions, allowing partial application of any combination of arguments, regardless of their ...
Read more >
Methods | Nanoutils
Compares a value with an argument which is passed to lens -like function using equals. import { eqLens, lens } from 'nanoutils' const...
Read more >
Use Ramda.js to pull off items from object - Stack Overflow
Ramda has a generic lens function, and specific ones for an object ... const lensMatch = (path) => (key) => lens ( find...
Read more >
Lenses + pathEq - - Bountysource
Hi,. I am using lenses extensively and I am defining all data focusers as lenses. Problem is when I want to use functions...
Read more >
Ravendree Pather Optometrist - Facebook
Have a high prescription ? Why settle for thick, heavy and bulky lenses? Have your lenses thinned down by opting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found