/* * 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) } }.