mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
Merge branch 'zero-sumtypes' of https://github.com/hellerve/Carp into hellerve-zero-sumtypes
This commit is contained in:
commit
504f63ffb4
@ -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))
|
||||
)
|
||||
|
@ -502,6 +502,26 @@ a value using <code>zero</code> if a <code>Nothing</code> is passed.</p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="binder">
|
||||
<a class="anchor" href="#zero">
|
||||
<h3 id="zero">
|
||||
zero
|
||||
</h3>
|
||||
</a>
|
||||
<div class="description">
|
||||
defn
|
||||
</div>
|
||||
<p class="sig">
|
||||
(λ [] (Maybe a))
|
||||
</p>
|
||||
<pre class="args">
|
||||
(zero)
|
||||
</pre>
|
||||
<p class="doc">
|
||||
<p>returns <code>Nothing</code>.</p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="binder">
|
||||
<a class="anchor" href="#zip">
|
||||
<h3 id="zip">
|
||||
|
@ -63,6 +63,11 @@
|
||||
(or-zero (the (Maybe Int) (Nothing)))
|
||||
"or-zero works on Nothing"
|
||||
)
|
||||
(assert-equal test
|
||||
&(Nothing)
|
||||
&(the (Maybe Int) (zero))
|
||||
"zero works"
|
||||
)
|
||||
(assert-equal test
|
||||
&(Result.Success 1)
|
||||
&(to-result (Just 1) @"error")
|
||||
|
Loading…
Reference in New Issue
Block a user