core: implement zero for Maybe and Result

This commit is contained in:
hellerve 2019-06-06 20:32:55 +02:00
parent 87fe06bfbc
commit 918c893189
2 changed files with 6 additions and 0 deletions

View File

@ -66,4 +66,7 @@ It is the inverse of [`just?`](#just?).")
(if (null? a)
(Nothing)
(Just @(Pointer.to-ref a))))
(doc zero "returns `Nothing`.")
(defn zero [] (Nothing))
)

View File

@ -106,6 +106,9 @@ It is the inverse of [`success?`](#success?).")
(match @b
(Success _) false
(Error y) (= x y))))
(doc zero "returns `(Success (zero))`.")
(defn zero [] (Success (zero)))
)
(defmodule Maybe