-
Notifications
You must be signed in to change notification settings - Fork 179
Expand file tree
/
Copy pathUnit.carp
More file actions
35 lines (31 loc) · 772 Bytes
/
Unit.carp
File metadata and controls
35 lines (31 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(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)
)