Skip to content

Commit b9df178

Browse files
Willyboarlpil
authored andcommitted
Update to work with gleam 1.9.1
1 parent b769578 commit b9df178

File tree

5 files changed

+29
-22
lines changed

5 files changed

+29
-22
lines changed

Diff for: .github/workflows/test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
test:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515
- uses: erlef/setup-beam@v1
1616
with:
17-
otp-version: "26.0.2"
18-
gleam-version: "1.0.0"
17+
otp-version: "27.1.2"
18+
gleam-version: "1.9.1"
1919
rebar3-version: "3"
2020
- run: gleam deps download
2121
- run: gleam test --target erlang

Diff for: CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
- Updated for Gleam v1.9.1
6+
- Update code actions
7+
- Update dependencies
8+
- Replace removed `string.trim_left` with `string.trim_start`
9+
310
## v1.2.0 - 2022-05-29
411

512
- Make the library compatible with the JavaScript target

Diff for: gleam.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ description = "A Gleam Lisp interpreter"
55

66
repository = { type = "github", user = "gleam-lang", repo = "example_lisp_interpreter" }
77
links = [
8-
{ title = "Website", href = "https://gleam.run" },
9-
{ title = "Sponsor", href = "https://github.com/sponsors/lpil" },
8+
{ title = "Website", href = "https://gleam.run" },
9+
{ title = "Sponsor", href = "https://github.com/sponsors/lpil" },
1010
]
1111

1212
[dependencies]
13-
gleam_stdlib = "~> 0.34 or ~> 1.0"
13+
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
1414

1515
[dev-dependencies]
16-
gleeunit = "~> 1.0"
16+
gleeunit = ">= 1.0.0 and < 2.0.0"

Diff for: manifest.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# You typically do not need to edit this file
33

44
packages = [
5-
{ name = "gleam_stdlib", version = "0.36.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "C0D14D807FEC6F8A08A7C9EF8DFDE6AE5C10E40E21325B2B29365965D82EB3D4" },
6-
{ name = "gleeunit", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "D364C87AFEB26BDB4FB8A5ABDE67D635DC9FA52D6AB68416044C35B096C6882D" },
5+
{ name = "gleam_stdlib", version = "0.58.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "091F2D2C4A3A4E2047986C47E2C2C9D728A4E068ABB31FDA17B0D347E6248467" },
6+
{ name = "gleeunit", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "0E6C83834BA65EDCAAF4FE4FB94AC697D9262D83E6F58A750D63C9F6C8A9D9FF" },
77
]
88

99
[requirements]
10-
gleam_stdlib = { version = "~> 0.34 or ~> 1.0" }
11-
gleeunit = { version = "~> 1.0" }
10+
gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" }
11+
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }

Diff for: src/glisp.gleam

+11-11
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
//// - The `empty` built-in procedure that returns an empty list
2424

2525
// -- Imports --
26+
import gleam/dict.{type Dict}
2627
import gleam/int
2728
import gleam/list
2829
import gleam/pair
2930
import gleam/result
3031
import gleam/string
31-
import gleam/dict.{type Dict}
3232

3333
// -- Types --
3434

@@ -61,7 +61,7 @@ pub type Scope =
6161

6262
/// State represents the state of the interpreter.
6363
/// It contains the global scope and the local scope.
64-
/// The local scope is used for local variables and
64+
/// The local scope is used for local variables and
6565
/// the global scope is used for global variables.
6666
pub type State {
6767
State(global_scope: Scope, local_scope: Scope)
@@ -79,7 +79,7 @@ type Parsed =
7979
type Procedure =
8080
fn(List(Expression), State) -> Evaluated
8181

82-
/// Eval function takes a string as an input and returns a result
82+
/// Eval function takes a string as an input and returns a result
8383
/// after evaluating the input.
8484
pub fn eval(source: String) -> Result(String, Error) {
8585
source
@@ -94,15 +94,15 @@ const empty = List([])
9494

9595
// -- Parsing --
9696

97-
/// Parse function takes a string as an input and a list of expressions and
97+
/// Parse function takes a string as an input and a list of expressions and
9898
/// returns a result after parsing the input.
9999
fn parse(
100100
source: String,
101101
expressions: List(Expression),
102102
) -> Result(List(Expression), Error) {
103103
use #(expression, rest) <- result.try(parse_expression(source))
104104
let expressions = [expression, ..expressions]
105-
case string.trim_left(rest) {
105+
case string.trim_start(rest) {
106106
"" -> Ok(list.reverse(expressions))
107107
_ -> parse(rest, expressions)
108108
}
@@ -112,7 +112,7 @@ fn parse(
112112
/// after parsing the expressions included in the source.
113113
/// Also checks for unexpected end of file and unexpected close parenthesis.
114114
fn parse_expression(source: String) -> Parsed {
115-
let source = string.trim_left(source)
115+
let source = string.trim_start(source)
116116
case source {
117117
"" -> Error(UnexpectedEndOfFile)
118118
")" <> _ -> Error(UnexpectedCloseParen)
@@ -133,7 +133,7 @@ fn tail_recursive_parse_list(
133133
source: String,
134134
elements: List(Expression),
135135
) -> Parsed {
136-
let source = string.trim_left(source)
136+
let source = string.trim_start(source)
137137
case source {
138138
"" -> Error(UnexpectedEndOfFile)
139139
")" <> rest -> Ok(#(List(list.reverse(elements)), rest))
@@ -146,7 +146,7 @@ fn tail_recursive_parse_list(
146146

147147
/// Parse_atom function takes a string as a source and returns a result
148148
/// Atoms can be integers, booleans or symbols.
149-
/// This function also checks for unexpected end of file and
149+
/// This function also checks for unexpected end of file and
150150
/// unexpected close parenthesis.
151151
fn parse_atom(source: String) -> Parsed {
152152
let #(content, rest) = parse_atom_content(source, "")
@@ -461,7 +461,7 @@ fn let_builtin(expressions: List(Expression), state: State) -> Evaluated {
461461
Ok(#(value, set_locals(state, original_locals)))
462462
}
463463

464-
/// Evaluate_binding function takes a state and a binding and returns a result
464+
/// Evaluate_binding function takes a state and a binding and returns a result
465465
/// after evaluating the binding.
466466
fn evaluate_binding(state: State, binding: Expression) -> Result(State, Error) {
467467
use binding <- result.try(expect_list(binding))
@@ -575,7 +575,7 @@ fn type_error(expected: String, value: Expression) -> Result(anything, Error) {
575575
/// arity_error function takes an expected arity and a list of expressions and
576576
/// returns a result after creating an arity error.
577577
/// It is used to create an arity error when the expected arity and the length
578-
///
578+
///
579579
fn arity_error(expected: Int, got: List(a)) -> Result(anything, Error) {
580580
Error(IncorrectArity(expected: expected, got: list.length(got)))
581581
}
@@ -665,7 +665,7 @@ fn type_name(value: Expression) -> String {
665665
}
666666
}
667667

668-
/// Print function takes an expression and prints a string representing the
668+
/// Print function takes an expression and prints a string representing the
669669
/// expression.
670670
fn print(value: Expression) -> String {
671671
case value {

0 commit comments

Comments
 (0)