std.show

Value to string conversion.

Types

type Show a = { show : a -> String }

Show a represents a conversion function from a to a readable string.

Values

let show ?s : forall a . [Show a] -> a -> String

Converts a value into a string.

let { ? } = import! std.effect
let { assert_eq, ? } = import! std.test
let list @ { ? } = import! std.list

seq assert_eq (show 123) "123"
seq assert_eq (show 3.14) "3.14"
seq assert_eq (show "abc") "\"abc\""
assert_eq (show (list.of [1, 2, 3])) "[1, 2, 3]"