11

I'm trying to use the Basics.toString function:

type Foo = Bar | Baz

main = text (toString Bar)

which, according to the Basics documentation, should be imported by default, but I'm getting a compile error:

I cannot find a `toString` variable:

13| main = text (toString Bar)

What am I missing?

Simon Morgan
  • 2,018
  • 5
  • 23
  • 36

1 Answers1

16

Basics.toString was removed in version 0.19:

You'll need to use one of Debug.toString, String.fromInt or String.fromFloat, depending on the type of Bar.

Captain Hat
  • 2,444
  • 1
  • 14
  • 31
  • 8
    Note also that the `Debug` module isn't available in production builds (hence the name). If you intend to use it in production for custom types, you'll need to write your own string conversion function. – glennsl May 11 '19 at 13:49