fmt
This commit is contained in:
parent
724a3d2b68
commit
4930cd3ae3
5 changed files with 38 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
version=0.27.0
|
version=0.27.0
|
||||||
exp-grouping=preserve
|
exp-grouping=preserve
|
||||||
break-infix=wrap-or-vertical
|
type-decl=sparse
|
||||||
|
break-infix=fit-or-vertical
|
||||||
break-collection-expressions=wrap
|
break-collection-expressions=wrap
|
||||||
break-sequences=false
|
break-sequences=false
|
||||||
break-infix-before-func=false
|
break-infix-before-func=false
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@
|
||||||
https://docs.taler.net/design-documents/003-tos-rendering.html *)
|
https://docs.taler.net/design-documents/003-tos-rendering.html *)
|
||||||
|
|
||||||
(* todo: maybe move this type to config.ml *)
|
(* todo: maybe move this type to config.ml *)
|
||||||
type t = Terms | Privacy
|
type t =
|
||||||
|
| Terms
|
||||||
|
| Privacy
|
||||||
|
|
||||||
let etag = function
|
let etag = function
|
||||||
| Terms -> Config.terms_etag
|
| Terms -> Config.terms_etag
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,11 @@ let currency_to_string = function `Eur -> "EUR"
|
||||||
|
|
||||||
(* Values that represent an amount are in the usual amount syntax: CURRENCY:VALUE.FRACTION,
|
(* Values that represent an amount are in the usual amount syntax: CURRENCY:VALUE.FRACTION,
|
||||||
e.g. EUR:1.50. The FRACTION portion may extend up to 8 places. *)
|
e.g. EUR:1.50. The FRACTION portion may extend up to 8 places. *)
|
||||||
type value = { currency: [ `Eur ]; value: int; fraction: int }
|
type value = {
|
||||||
|
currency: [ `Eur ]
|
||||||
|
; value: int
|
||||||
|
; fraction: int
|
||||||
|
}
|
||||||
|
|
||||||
let currency_round_unit = { currency= `Eur; value= 0; fraction= 1 }
|
let currency_round_unit = { currency= `Eur; value= 0; fraction= 1 }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,14 @@ end = struct
|
||||||
type t = string
|
type t = string
|
||||||
|
|
||||||
(* type for the value of header field *)
|
(* type for the value of header field *)
|
||||||
type header_etag_item = { weak: bool; value: string }
|
type header_etag_item = {
|
||||||
type header_value = Any_etag | Etag_list of header_etag_item list
|
weak: bool
|
||||||
|
; value: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type header_value =
|
||||||
|
| Any_etag
|
||||||
|
| Etag_list of header_etag_item list
|
||||||
|
|
||||||
let pp_header_etag_item ppf { weak; value } =
|
let pp_header_etag_item ppf { weak; value } =
|
||||||
if weak then Fmt.pf ppf {|W/"%s"|} value else Fmt.pf ppf {|"%s"|} value
|
if weak then Fmt.pf ppf {|W/"%s"|} value else Fmt.pf ppf {|"%s"|} value
|
||||||
|
|
|
||||||
22
src/types.ml
22
src/types.ml
|
|
@ -2,14 +2,32 @@
|
||||||
module Error_detail = struct
|
module Error_detail = struct
|
||||||
(* TODO GANA error codes
|
(* TODO GANA error codes
|
||||||
https://git.gnunet.org/gana.git/tree/gnu-taler-error-codes/registry.rec *)
|
https://git.gnunet.org/gana.git/tree/gnu-taler-error-codes/registry.rec *)
|
||||||
type t = { code: int; hint: string option }
|
type t = {
|
||||||
|
code: int
|
||||||
|
; hint: string option
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
(* TODO number
|
||||||
|
- number is "float", but we probably want int everywhere instead
|
||||||
|
- numeric values capped at 2^53 -1 inclusive because json
|
||||||
|
- have a type for seconds/microseconds/..? *)
|
||||||
module Timestamp = struct
|
module Timestamp = struct
|
||||||
(* Seconds since epoch, or the special
|
(* Seconds since epoch, or the special
|
||||||
value "never" to represent an event that will
|
value "never" to represent an event that will
|
||||||
never happen. *)
|
never happen. *)
|
||||||
type t = Never | Seconds of float
|
type t =
|
||||||
|
| Seconds of float
|
||||||
|
| Never
|
||||||
|
end
|
||||||
|
|
||||||
|
module Relative_time = struct
|
||||||
|
(* Duration in microseconds or "forever"
|
||||||
|
to represent an infinite duration. Numeric
|
||||||
|
values are capped at 2^53 - 1 inclusive. *)
|
||||||
|
type t =
|
||||||
|
| Microseconds of float
|
||||||
|
| Forever
|
||||||
end
|
end
|
||||||
|
|
||||||
module Amount = struct
|
module Amount = struct
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue