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.

NonEmptyList map gives me :: Seq<'b>

See original GitHub issue

given a NonEmptyList<'a> and running that thru FSharpPlus.Operators.map I am getting a Seq<'b> where as I expected it to return a NonEmptyList<'b>. What am I doing wrong? Only when I fully qualify the call to map like

NonEmptyList.map transform someNonEmptyList

the result is the correct type of functor

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gustycommented, Jan 21, 2017

@mausch the instance is within the class. Although now that FsControl was merged, we can put it in the Invokable, I have the impression that is good to keep the separation and only specify instances for primitive types in the Invokables.

@robkuz I think this issue was recently solved here but probably you are using the latest nuget which is previous to that fix.

The problem is that in some cases interfaces “eat” all instances before the instance declared in the type. This happens because F# does some automatically conversions (upcasts) in some situations.

So I did some workarounds to give either less priority to the interfaces overload, in cases where it’s still usable, or to reject compiling it unless it’s explicitly upcasted as an interface, which is the case of the functor for NonEmptyList.

Try the latest code and let me know if it works in your scenario. If so I will see if I can upload a new nuget tonight.

0reactions
robkuzcommented, Feb 20, 2017

Seems to work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

NonEmptyList
A data type which represents a non empty list of A, with single element (head) and ... to the Order of the keys...
Read more >
Collapse / Flatten cats Seq / List of cats.Validated
I've tried foldMap and traverse but invarialby run into issues that I don't have a Monoid in scope, and I feel like cats...
Read more >
.filter(_.nonEmpty).map(_.get)
I quite often need to create a list of objects of a initial sequence of data where not all elements results in newly...
Read more >
NonEmptyList (FSharpPlus)
Returns a list that contains no duplicate entries according to the generic hash and equality comparisons on the keys returned by the given...
Read more >
Map Labeling Algorithms with Application in Graph ...
In this thesis, we propose an alternative formulation to the map labeling problem, which addresses these ... who gave me help and support...
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