Carp/core/Unit.carp
2021-07-05 14:48:35 +02:00

36 lines
772 B
Plaintext

(doc Unit "is the empty type, also represented as `()` and equivalent to `void`
in C.")
(defmodule Unit
(implements prn prn)
(sig prn (Fn [Unit] String))
(defn prn [unit]
@"()")
(doc copy
"'copies' a reference to a Unit value."
"This function just returns a fresh value of type Unit.")
(implements copy copy)
(sig copy (Fn [(Ref Unit)] Unit))
(defn copy [unit-ref]
())
(doc zero
"Returns a fresh value of type Unit (this value performs no side-effects).")
(implements zero zero)
(sig zero (Fn [] Unit))
(defn zero []
())
(implements = =)
(sig = (Fn [Unit Unit] Bool))
(defn = [unit-a unit-b]
true)
)
(defmodule UnitRef
(implements = =)
(sig = (Fn [&Unit &Unit] Bool))
(defn = [unit-a unit-b]
true)
)