Stream: bugs

Topic: missing method: from_numeral


view this post on Zulip Fabian Schmalzried (Dec 04 2025 at 13:05):

app [main!] { pf: platform "../test/fx/platform/main.roc" }

import pf.Stdout
import pf.Stdin

main! = || {
    count = get_two()

    Stdout.line!(count)
}

get_two = || {
    var $val = 1
    $val = $val + 1
    $val
}

output:

-- MISSING METHOD --------------------------------

This from_numeral method is being called on a value whose type doesn't have that method:
   ┌─ AOC/playground.roc:14:19
   │
14 │     $val = $val + 1
   │                   ^

The value's type, which does not have a method named from_numeral, is:

    Str

Hint: For this to work, the type would need to have a method named from_numeral associated with it in the type's declaration.

also added it as gh issue: #8570

view this post on Zulip Fabian Schmalzried (Dec 04 2025 at 13:25):

I will investigate it a bit myself. I let you know how it goes.

view this post on Zulip Richard Feldman (Dec 04 2025 at 13:30):

the error message is confusing, but the reason it's erroring is that Stdout.line! takes a string and not a number :sweat_smile:

view this post on Zulip Fabian Schmalzried (Dec 04 2025 at 13:37):

that makes a lot of sense. Interstingly with this one:

app [main!] { pf: platform "../test/fx/platform/main.roc" }

import pf.Stdout
import pf.Stdin

main! = || {
    count = get_two()

    Stdout.line!(U64.to_str(count))
}

get_two = || {
    var $val = 1
    $val = $val + 1
    $val
}

I get the output 2000000000000000000

view this post on Zulip Fabian Schmalzried (Dec 04 2025 at 13:40):

dbg count gives 2, so probably something with to_str?

view this post on Zulip Richard Feldman (Dec 04 2025 at 13:46):

yeah seems like it!


Last updated: Dec 21 2025 at 12:15 UTC