diff --git a/src/fortheck/error.gleam b/src/fortheck/error.gleam deleted file mode 100644 index f1ee495..0000000 --- a/src/fortheck/error.gleam +++ /dev/null @@ -1,4 +0,0 @@ -pub type Error { - StackOverflow - StackUnderflow -} diff --git a/src/fortheck/stack.gleam b/src/fortheck/stack.gleam index 69bedf7..2610f1d 100644 --- a/src/fortheck/stack.gleam +++ b/src/fortheck/stack.gleam @@ -1,8 +1,12 @@ -import fortheck/error.{type Error, StackOverflow, StackUnderflow} import gleam/bool import gleam/list import gleam/result +pub type Error { + StackOverflow + StackUnderflow +} + pub opaque type Stack(a) { Stack(capacity: Int, length: Int, data: List(a)) } diff --git a/test/fortheck/stack_test.gleam b/test/fortheck/stack_test.gleam index a17a552..1b17cce 100644 --- a/test/fortheck/stack_test.gleam +++ b/test/fortheck/stack_test.gleam @@ -1,5 +1,4 @@ -import fortheck/error -import fortheck/stack +import fortheck/stack.{type Error, StackOverflow, StackUnderflow} import gleam/iterator import gleam/pair import gleam/result @@ -32,7 +31,7 @@ pub fn push_stack_overflow_test() { |> should.be_ok |> stack.push(1) |> should.be_error - |> should.equal(error.StackOverflow) + |> should.equal(StackOverflow) } pub fn from_list_test() { @@ -47,7 +46,7 @@ pub fn pop_stack_underflow_test() { stack.new() |> stack.pop |> should.be_error - |> should.equal(error.StackUnderflow) + |> should.equal(StackUnderflow) } pub fn pop_test() { @@ -74,5 +73,5 @@ pub fn pop_2_stack_underflow_test() { stack.from_list([1]) |> result.try(stack.pop_2) |> should.be_error - |> should.equal(error.StackUnderflow) + |> should.equal(StackUnderflow) }