there are a few things that I'm not sure about, I'm feeling stupid/frustrated:
is there an approx equal for Frac?
Not yet, but it does seem like a lot of languages have something available for that. I made an issue to explore the idea #6349.
is there a way to define infix function or overload operators?
No, this was a deliberate decision.
is there something like Haskell $?
I think you can use |>
instead, but you'd have to change the order compared to $
in haskell.
is it possible to expand Num (i.e. for complex numbers)?
Not in the way your thinking of probably, but @Hannes does have some support for them in his roc-math package.
is there a toDec ? how can I convert a Fractional to a Decimal?
It does indeed seem like toDec
is missing from Num
, I'll check if we just forgot about it :p
You can do Num.toStr
and Std.toDec
.
Yes. we have an issue for it #5446
It does indeed seem like toDec is missing from Num, I'll check if we just forgot about it :p
You can do Num.toStr and Std.toDec.
Amazing how a feature like this can go missing for so long. You would think that it would have been hit by now.
Last updated: Jul 06 2025 at 12:14 UTC