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 there. Would you please consider renaming the promap method to lens (or something like this)?

This implementation of promap does not appear to unify with the type signature for the promap operation specified in Fantasy-Land (or more generally with how profunctors are specified in other languages). The expected signature is p a b ~> (a' -> a, b -> b') -> p a' b', which does not line up in terms of arity with:

  const celsiusProf = appProf.promap(
    state => fToC(state.fahrenheit),
    (celsius, state) => ({ ...state, fahrenheit: cToF(celsius) })
  );

AFAICT this is a concrete getter setter lens being passed into a method that applies it to state and setState.

While there is a way to utilize a profunctor lens for the same purpose, to do this you have to lawfully implement promap, and then use a profunctor lens to transform a value of the lawful profunctor type.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
DylanRJohnstoncommented, Jan 13, 2020

Yep, the expanded definition is super easy to write

type Lens<A, B, S, T> = {
  get: (s: S) => A;
  set: (b: B, s: S) => T;
};

const promap = <A, B, S, T, U, V>(
  lens: Lens<A, B, S, T>,
  f: (u: U) => S,
  g: (t: T) => V,
): Lens<A, B, U, V> => ({
  get: u => lens.get(f(u)),
  set: (b, u) => g(lens.set(b, f(u))),
});
0reactions
masaeeducommented, Jan 13, 2020

The type Lens_<-, -> does not support an instance of Profunctor (although it’s probably a profunctor between a different set of categories), if that’s what you’re trying to figure out.

The type Lens is contravariant in S and B, and covariant in A and T. Once you set S and A to be the same type you can’t really contravariantly map A and likewise you can’t covariantly map B.

Read more comments on GitHub >

github_iconTop Results From Across the Web

To organise files and folders - Promap Help
Move files from one folder to another. Create subfolders to organise your saved files more efficiently. Delete files and folders. Rename files and...
Read more >
Nintex Promapp - Changing the Name of the Standard Variation
You can change the name of the Standard across all Variation Processes by updating the Custom Standard Variation Label in Admin > Configure ......
Read more >
Make a layout—ArcGIS Pro | Documentation
It will be easier to tell them apart if you rename them. In the Contents pane, with Map Frame 1 selected, click the...
Read more >
How to change the name of a layer in the Layout legend?
Is it possible to change the name of a LAYER and the ITEM in the ... the layer and adding a custom symbology...
Read more >
Promap 4 User Guide - Landmark Information Group
Promap gives you instant, online access to nine different layers of large and small scale digital maps. ... You can move, delete and...
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