aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/collection/stack.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/data/collection/stack.lux')
-rw-r--r--stdlib/source/lux/data/collection/stack.lux65
1 files changed, 0 insertions, 65 deletions
diff --git a/stdlib/source/lux/data/collection/stack.lux b/stdlib/source/lux/data/collection/stack.lux
deleted file mode 100644
index 68d514331..000000000
--- a/stdlib/source/lux/data/collection/stack.lux
+++ /dev/null
@@ -1,65 +0,0 @@
-(.module:
- [lux #*
- [abstract
- [equivalence (#+ Equivalence)]
- [functor (#+ Functor)]]
- [data
- [collection
- ["//" list]]]
- [type
- abstract]])
-
-(abstract: #export (Stack a)
- (List a)
-
- (def: #export empty
- Stack
- (:abstraction (list)))
-
- (def: #export size
- (All [a] (-> (Stack a) Nat))
- (|>> :representation //.size))
-
- (def: #export empty?
- (All [a] (-> (Stack a) Bit))
- (|>> :representation //.empty?))
-
- (def: #export (peek stack)
- (All [a] (-> (Stack a) (Maybe a)))
- (case (:representation stack)
- #.Nil
- #.None
-
- (#.Cons value _)
- (#.Some value)))
-
- (def: #export (pop stack)
- (All [a] (-> (Stack a) (Maybe [a (Stack a)])))
- (case (:representation stack)
- #.Nil
- #.None
-
- (#.Cons top stack')
- (#.Some [top (:abstraction stack')])))
-
- (def: #export (push value stack)
- (All [a] (-> a (Stack a) (Stack a)))
- (:abstraction (#.Cons value (:representation stack))))
-
- (implementation: #export (equivalence super)
- (All [a]
- (-> (Equivalence a)
- (Equivalence (Stack a))))
-
- (def: (= reference subject)
- (\ (//.equivalence super) = (:representation reference) (:representation subject))))
-
- (implementation: #export functor
- (Functor Stack)
-
- (def: (map f value)
- (|> value
- :representation
- (\ //.functor map f)
- :abstraction)))
- )