db_model.anubis
1.89 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* Created by PyramIDE.
* User: フランスのトトロ
* Date: 01/01/2016
* Time: 1:34
* © David RENÉ
*/
*** (1.2) 'MaybeNull'.
This type scheme is isomorphic to 'Maybe', and is used for representing data which
can have the value 'NULL'. We don't use 'Maybe' for this purpose because
we want to avoid the misleading 'Maybe(Maybe(...))'. Instead, we will have
sometimes 'Maybe(MaybeNull(...))', so that 'null' means 'NULL', and 'failure'
means an error.
public type MaybeNull($T):
null,
not_null($T value).
Conversion tools between date, time and datetime in ISO-8601 format and 'Int'
(number of seconds since the epoch) are provided in 'library/tools/ISO-8601.anubis'.
--- That's all for the public part !----------------------------------------------------------------
read tools/basis.anubis
read tools/base64.anubis
read system/string.anubis
read tools/ISO-8601.anubis
read xlib/web/widgets/icons_set.anubis
*** [1] Tools.
*** [1.1] Concatenating strings which may not exist.
The concatenation function '+' for strings is defined in 'tools/basis.anubis'. Here we define
an extension of it to strings which may not exist (i.e. data of type 'Maybe(String)'). Of course,
the result is always of type 'Maybe(String)'.
define macro Maybe(String)
Maybe(String) s + String t
=
if s is
{
failure then failure,
success(s1) then success(s1+t)
}.
define macro Maybe(String)
String s + Maybe(String) t
=
if t is
{
failure then failure,
success(t1) then success(s+t1)
}.
define macro Maybe(String)
Maybe(String) s + Maybe(String) t
=
if s is
{
failure then failure,
success(s1) then if t is
{
failure then failure,
success(t1) then success(s1+t1)
}
}.