diff options
author | Eduardo Julián | 2021-07-14 14:44:53 -0400 |
---|---|---|
committer | GitHub | 2021-07-14 14:44:53 -0400 |
commit | 89ca40f2f101b2b38187eab5cf905371cd47eb57 (patch) | |
tree | f05fd1677a70988c6b39c07e52d031d86eff28f1 /stdlib/source/lux/data/collection/stack.lux | |
parent | 2431e767a09894c2f685911ba7f1ba0b7de2a165 (diff) | |
parent | 8252bdb938a0284dd12e7365b4eb84b5357bacac (diff) |
Merge pull request #58 from LuxLang/hierarchy_normalization
Hierarchy normalization
Diffstat (limited to 'stdlib/source/lux/data/collection/stack.lux')
-rw-r--r-- | stdlib/source/lux/data/collection/stack.lux | 65 |
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))) - ) |