diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-06-25 22:48:07 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-06-25 22:48:07 +0100 |
commit | 2c2541750ca4b7b604070c75c18d84be833c97d5 (patch) | |
tree | f5e63d941a1c7e2c2d4dff1d81c43fa2766308ae /src/std/any.gleam | |
parent | 96c20b8ebf8420fbba75c97fa08eaeb34e8dc394 (diff) | |
download | gleam_stdlib-2c2541750ca4b7b604070c75c18d84be833c97d5.tar.gz gleam_stdlib-2c2541750ca4b7b604070c75c18d84be833c97d5.zip |
stdlib namespace std -> gleam
Diffstat (limited to 'src/std/any.gleam')
-rw-r--r-- | src/std/any.gleam | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/std/any.gleam b/src/std/any.gleam deleted file mode 100644 index ac902cd..0000000 --- a/src/std/any.gleam +++ /dev/null @@ -1,53 +0,0 @@ -import std/list as list_mod -import std/atom -import std/result - -// `Any` data is data that we don"t know the type of yet. -// We likely get data like this from interop with Erlang, or from -// IO with the outside world. -// -pub external type Any; - -// Convert any Gleam data into `Any` data. -// -pub external fn from(a) -> Any = "gleam__stdlib" "identity"; - -// Unsafely cast any type into any other type. -// -// This is an escape hatch for the type system that may be useful when wrapping -// native Erlang APIs. It is to be used as a last measure only. -// -pub external fn unsafe_coerce(a) -> b = "gleam__stdlib" "identity"; - -pub external fn string(Any) -> Result(String, String) - = "gleam__stdlib" "decode_string" - -pub external fn int(Any) -> Result(Int, String) - = "gleam__stdlib" "decode_int" - -pub external fn float(Any) -> Result(Float, String) - = "gleam__stdlib" "decode_float" - -pub external fn atom(Any) -> Result(atom:Atom, String) - = "gleam__stdlib" "decode_atom" - -pub external fn bool(Any) -> Result(Bool, String) - = "gleam__stdlib" "decode_bool" - -pub external fn thunk(Any) -> Result(fn() -> Any, String) - = "gleam__stdlib" "decode_thunk" - -external fn list_any(Any) -> Result(List(Any), String) = - "gleam__stdlib" "decode_list" - -pub fn list(any, decode) { - any - |> list_any - |> result:then(_, list_mod:traverse(_, decode)) -} - -pub external fn tuple(Any) -> Result({Any, Any}, String) - = "gleam__stdlib" "decode_tuple" - -pub external fn field(Any, a) -> Result(Any, String) - = "gleam__stdlib" "decode_field" |