Skip to content
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

interface{} does not implement comparable [InvalidTypeArg] #1

Closed
hughjfchen opened this issue Mar 21, 2022 · 2 comments
Closed

interface{} does not implement comparable [InvalidTypeArg] #1

hughjfchen opened this issue Mar 21, 2022 · 2 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@hughjfchen
Copy link

I've been just trying to explore FP in go and found this. I tried to open the code but met following error:
interface{} does not implement comparable [InvalidTypeArg]

The code has such an error is in stream.go:
// StreamFromInterface New Stream instance from an array func StreamFromInterface(list ...interface{}) *StreamDef[interface{}] { return StreamFromArray(list) }
Line 17 to line 21

I'm using go 1.18 on MacOs 12.3

@johnteee johnteee added the bug Something isn't working label Mar 31, 2022
@johnteee johnteee self-assigned this Mar 31, 2022
@johnteee
Copy link
Member

Thank you for reports!

Because we use map[key]value to deduplicate items & sort etc,
and key must be comparable constrants after golang 1.18.
so now FromInterface/FromArrayInterface methods of Stream/StreamSet have been removed.

All tests are passed on golang 1.18,
and the problems are fixed in fpGo v2.0.0

Thanks for reporting again 😄

Fix patches are here:
5a35fcb

@johnteee
Copy link
Member

johnteee commented Apr 3, 2022

@hughjfchen
After considering about functionalities,
finally I add back the non-generics version of Stream/Set/StreamSet etc.

I tested it and released it on v2.1.0

More examples are here
https://github.com/TeaEntityLab/fpGo/blob/master/streamForInterface_test.go

Thanks for your advices!!

@johnteee johnteee added the enhancement New feature or request label Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants