From 06928fccf543143bfacb0569297bef5d8184e58f Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Sat, 27 Oct 2018 22:41:25 +0000 Subject: Foreign -> Any Closes https://github.com/lpil/gleam/issues/21 --- src/any.gleam | 24 ++++++++++++++++++++++++ src/foreign.gleam | 24 ------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 src/any.gleam delete mode 100644 src/foreign.gleam (limited to 'src') diff --git a/src/any.gleam b/src/any.gleam new file mode 100644 index 0000000..05a789b --- /dev/null +++ b/src/any.gleam @@ -0,0 +1,24 @@ +doc """ +`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 +; + +doc """ +Convert any Gleam data into `Any` data. +""" +pub external fn new(a) -> Any = 'gleam_foreign' 'identity' + +doc """ +Unsafely cast any type into any other type.o + +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 unsafeCoerce(a) -> b = 'gleam_foreign' 'identity' + +fn identity(x) { + x +} diff --git a/src/foreign.gleam b/src/foreign.gleam deleted file mode 100644 index 5d33aa2..0000000 --- a/src/foreign.gleam +++ /dev/null @@ -1,24 +0,0 @@ -doc """ -Foreign 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 Foreign -; - -doc """ -Convert any Gleam data into Foreign data. -""" -pub external fn new(a) -> Foreign = 'gleam_foreign' 'identity' - -doc """ -Unsafely cast any type into any other type.o - -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 unsafeCoerce(a) -> b = 'gleam_foreign' 'identity' - -fn identity(x) { - x -} -- cgit v1.2.3