Basics module does not expose toString

Hey o/

While trying to learn Elm, I got stuck trying to convert a Int to a String. Here’s my attempt:

parseMyInt : Int -> String
parseMyInt value =
    Basics.toString value

And I get this as result:

I cannot find a `Basics.toString` variable:121|     Basics.toString value         ^^^^^^^^^^^^^^^The `Basics` module does not expose a `toString` variable.

I noticed that my elm.json file has only versions 1.0.0 for the elm/core package. However, when I try to update it by hand, elm tells me its incompatible and I should update with elm install elm/core. However, this command does nothing.

elm-reactorhas no options to update my packages either.

My elm.json file:

{
    "type": "application",
    "source-directories": [
        "src"
    ],
    "elm-version": "0.19.0",
    "dependencies": {
        "direct": {
            "NoRedInk/elm-json-decode-pipeline": "1.0.0",
            "elm/browser": "1.0.0",
            "elm/core": "1.0.0",
            "elm/html": "1.0.0",
            "elm/http": "1.0.0",
            "elm/json": "1.0.0",
            "elm/url": "1.0.0",
            "fredcy/elm-parseint": "2.0.1"
        },
        "indirect": {
            "elm/time": "1.0.0",
            "elm/virtual-dom": "1.0.0"
        }
    },
    "test-dependencies": {
        "direct": {
            "elm-explorations/test": "1.0.0"
        },
        "indirect": {
            "elm/random": "1.0.0"
        }
    }
}

What am I missing? Is there a command to update my packages, specially the elm/core? (I think this is the one with Basics.toString, right?)

That’s changed in 0.19, I think this document should explain everything you need: https://github.com/elm/compiler/blob/master/upgrade-docs/0.19.md

3 Likes

Thank you!

String.fromInt solves my problem.

I guess there’ll lots of outdated tutorials online at this point. But this doc will help a lot :+1:

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.