aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2018-10-10 09:16:03 +0000
committerLouis Pilfold <louis@lpil.uk>2018-10-10 09:20:49 +0000
commit82ff1afa3bcab9d880eb6508e004cd71eb1f4a48 (patch)
treeee860fd639b19e45182728ee5a6ba00ea9e927d9 /src
parent6ccee8235d1ce882eb911fb07244dcf47861fa4e (diff)
downloadgleam_stdlib-82ff1afa3bcab9d880eb6508e004cd71eb1f4a48.tar.gz
gleam_stdlib-82ff1afa3bcab9d880eb6508e004cd71eb1f4a48.zip
fn type uses =>
Diffstat (limited to 'src')
-rw-r--r--src/Bool.gleam1
-rw-r--r--src/Foreign.gleam4
-rw-r--r--src/List.gleam17
3 files changed, 11 insertions, 11 deletions
diff --git a/src/Bool.gleam b/src/Bool.gleam
index cd25c32..2dfadc3 100644
--- a/src/Bool.gleam
+++ b/src/Bool.gleam
@@ -3,7 +3,6 @@ import Order:Order
pub enum Bool =
| True
| False
-;
import Bool:*
diff --git a/src/Foreign.gleam b/src/Foreign.gleam
index 868bc79..e921ea8 100644
--- a/src/Foreign.gleam
+++ b/src/Foreign.gleam
@@ -9,7 +9,7 @@ pub external type Foreign
doc """
Convert any Gleam data into Foreign data.
"""
-pub external fn new(a) { Foreign } = 'Gleam.Foreign' 'identity'
+pub external fn new(a) => Foreign = 'Gleam.Foreign' 'identity'
doc """
Unsafely cast any type into any other type.o
@@ -17,7 +17,7 @@ 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'
+pub external fn unsafeCoerce(a) => b = 'Gleam.Foreign' 'identity'
fn identity(x) {
x
diff --git a/src/List.gleam b/src/List.gleam
index 095562c..2656a2e 100644
--- a/src/List.gleam
+++ b/src/List.gleam
@@ -1,13 +1,14 @@
import Result:Result:*
import Bool:Bool:*
-pub enum Err =
+pub enum Error =
| Empty
-;
+
+import Error:*
// Using the Erlang C BIF implementation.
//
-pub external fn length(List(a)) { Int } = 'erlang' 'length'
+pub external fn length(List(a)) => Int = 'erlang' 'length'
test length {
length([]) |> Assert:equal(_, 0)
@@ -18,7 +19,7 @@ test length {
// Using the Erlang C BIF implementation.
//
-pub external fn reverse(List(a)) { List(a) } = 'erlang' 'reverse'
+pub external fn reverse(List(a)) => List(a) = 'erlang' 'reverse'
test reverse {
length([]) |> Assert:equal(_, [])
@@ -50,7 +51,7 @@ test is_member {
pub fn head(list) {
case list {
- | [] => Error(Err:Empty)
+ | [] => Error(Empty)
| elem :: _ => Ok(elem)
}
}
@@ -60,12 +61,12 @@ test head {
|> Assert:equal(_, Ok(0))
head([])
- |> Assert:equal(_, Error(Err:Empty))
+ |> Assert:equal(_, Error(Empty))
}
pub fn tail(list) {
case list {
- | [] => Error(Err:Empty)
+ | [] => Error(Empty)
| _ :: rest => Ok(rest)
}
}
@@ -78,7 +79,7 @@ test tail {
|> Assert:equal(_, Ok([]))
tail([])
- |> Assert:equal(_, Error(Err:Empty))
+ |> Assert:equal(_, Error(Empty))
}
pub fn filter(list, fun) {