-
Notifications
You must be signed in to change notification settings - Fork 32
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
0.4: map function doesn't support union types #76
Comments
You can create an observable like this: |
I think it does, but definitely a far less convenient syntax and definitely a gotcha that you can't just "use map". Is there any way to infer the return type of a function and use that? (Instead of just the type of the functions return value from the initial evaluation) |
You can also use
Yes, that's possible too. Of course, it gives you something too wide if your code breaks inferrability, but |
I can do a PR. I don't know how I'd go about it. Is there a de facto way of determining the return type of a function nowadays? And by convenient syntax, I mean the map syntax. Correct me if I'm wrong but what you're suggesting would require creating a new observable and map!-ing into it. |
Check out MappedArrays which seems to have wholeheartedly embraced your proposed strategy. (Just the simple stuff, don't worry about the fancy anonymous-function printing.) |
Observables.jl/src/Observables.jl
Line 477 in 0f94e69
For context, I have code that returns different things based on the state of observable:
This causes issues™:
I think it's the line referenced above that creates an
Observable{T}
whereT
is the type of the return value of the mapper function the first time it's executed.CC @rajraomichigan
The text was updated successfully, but these errors were encountered: