@Ayaz Hafiz question about the issue 2846 (https://github.com/rtfeldman/roc/issues/2846)
When the repl evals 3.1 + 2.0
what should the Symbol be for the result? Atm it says it’s Num.Num
. But the expression 3.1
is Num.Float
. Is this related to the issue?
Really? I see F64 when I use it.
I see F64 as well (web and local repl)
Sorry I don’t mean the string output in the repl. You’re both correct that it shows F64.
I mean the symbol value in the Alias data type
I’ll post a link to the exact spot, one second
This line here: https://github.com/rtfeldman/roc/blob/d23d5f249fb2fb1d6a3c5cc96b4fae9e1131eb9c/compiler/types/src/pretty_print.rs#L371
If I use a println!("symbol: {:?}", *symbol);
Inside that block of code I linked, I can see that the expressions have the symbols I mentioned earlier
Let me know if that makes sense please, I was poking around and thought maybe something with the repl expressions could be evaluating incorrectly. Thoughts?
I’m on London time, so I’ll be heading to bed now, but I’ll be back online soon. Thanks for your time
Oh yes. That is expected.
An F64 has Alias type should be “Num (FloatingPoint Binary64)”, F32 is “Num (FloatingPoint Binary32)”
This is not actually strictly true all the time, but should be enough for this issue.
Thanks for looking into this!
Can you explain a little more about the difference between these two expressions:
3.1
3.1 + 2.1
I feel like I may be misunderstanding the theory here. Like what’s the difference between something being Num_Float vs Num_FloatingPoint? Is one considered to be a Double or something?
Okay I think I've been able to learn some stuff by reading through the docs here:
https://github.com/rtfeldman/roc/blob/trunk/compiler/builtins/docs/Num.roc
What I learned:
Float a
is an alias for Num FloatingPoint a
.What I found:
Float
to F64
and then to Float *
Seems like the pretty printer was mostly updated around then, but there was a code path that was not updated. Specifically the Num FloatingPoint a
was still being mapped to F64
, while Float a
is being mapped to Float *
. Now that I understand that one is an alias for the other, I think we just need to update the other code path.
I have branch on the way, just need to setup my commit signing stuff first.
That sounds right! Thanks Sean.
Okay just pushed a pull request here: https://github.com/rtfeldman/roc/pull/2867
Thank you!
thank you!!
Okay the pull request finally passed all the checks :raised_hands:
Last updated: Jul 06 2025 at 12:14 UTC