diff options
Diffstat (limited to 'stdlib/maybe-with-unions.lisp')
| -rw-r--r-- | stdlib/maybe-with-unions.lisp | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/stdlib/maybe-with-unions.lisp b/stdlib/maybe-with-unions.lisp deleted file mode 100644 index 53a5024..0000000 --- a/stdlib/maybe-with-unions.lisp +++ /dev/null @@ -1,42 +0,0 @@ -; LIB - -(union! Maybe - (just value) - (nothing)) - -(let! Maybe/map (\[f m] - (match (kind m) - "Maybe/Just" (Maybe/just (f (Maybe/Just/get-value m))) - "Maybe/Nothing" (Maybe/nothing)))) - -(let! Maybe/and-then (\[f m] - (match (kind m) - "Maybe/Just" (f (Maybe/Just/get-value m)) - "Maybe/Nothing" (Maybe/nothing)))) - -; TESTING - -;; (let! print-line! (\[s] -;; (print! (concat s "\n")))) - -;; (let! a (Maybe/just 10)) -;; (let! b (Maybe/nothing)) - -;; (Maybe/map (+ 5) a) -;; (Maybe/map (+ 5) b) - -;; (Maybe/and-then (\[n] (Maybe/just (+ n 5))) a) -;; (Maybe/and-then (\[n] (Maybe/just (+ n 5))) b) - -;; (let! m (Maybe/just 10)) -;; (match m -;; (Maybe/just _) -;; (print-line! (fmt "found just {0}!" [(Maybe/Just/get-value m)])) -;; (Maybe/nothing) -;; (print-line! "found nothing!")) - -;; (let! m (Maybe/just 10)) -;; (pipe m [ -;; (Maybe/map (+ 5)) -;; (Maybe/and-then (\[val] (Maybe/just (- val 3)))) -;; ]) |
