kxcinc / kxclib-ocaml Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://kxcinc.github.io/kxclib-ocaml/
License: MIT License
Home Page: https://kxcinc.github.io/kxclib-ocaml/
License: MIT License
Fn.gate0 : ('r -> 'r) -> bool-> 'r -> 'r
Fn.gate1 : ('a -> 'r -> 'r) -> bool-> 'a -> 'r -> 'r
Fn.gate2 : ('a -> 'b -> 'r -> 'r) -> bool-> 'a -> 'b -> 'r -> 'r
(* .. *)
may_append : bool -> 'a -> 'a list -> 'a list
may_append = Fn.gate1 !!(@)
Option.try_make : ?capture:(exn -> bool) -> (unit -> 'x) -> 'x option
Option.try_make ~capture f
returns Some (f())
when f()
does not throw,
None
when f()
throws an exn
where capture exn = true
and rethrow exn
otherwise.
?capture
defaults to constant true
.
also provide let (* Option. *) if_found f = try_make ~capture:(function Not_found -> true | _ -> false) f
{"kind":
"api-v1-static","formCode":"MockSignupFormV1_01",
"formOwner":
"j
p.co.anchorz","f
ormSteps":{"k
ind":"s
tatic-multiple-unstructured-steps",
"stepCount":
4}}
, actual {"kind":
"a
pi-v1-static","f
ormCode":
"MockSignupFormV1_01","f
ormOwner":
"j
p.co.anchorz",
"f
ormTitle":
{"ja":
"サンプルフォーム01",
"en":"S
ample Form 01"}
,"f
ormSynopsis":
{"ja":
"このフォームは偽物です。","en":
"T
his form is fake."}
,"f
ormSteps":{"k
ind":"s
tatic-multiple-unstructured-steps","s
tepCount":
4,
"f
ormDescriptorData":
"利用規約が入る予定"}}
module B64 = Base64.Make(struct include Base64.Config_rfc4648 let ignore_newline = true end);;
{|RGV2ZWxvcGVyIHByb2R1Y3Rpdml0eSBpcyBt
ZWFzdXJlZCBpbiBjYWZmZWluZSBpbnRha2Uu
IFRoZSBtb3JlIGNvZmZlZSBhIGRldmVsb3Bl
ciBjb25zdW1lcywgdGhlIGhpZ2hlciBpcyB0
aGVpciBwcm9kdWN0aXZpdHkuIEl0J3MgcnVt
b3JlZCB0aGF0IGRldmVsb3BlcnMgYXQgR29v
Z2xlIGNvbnN1bWUgdXAgdG8gdHdvIGh1bmRy
ZWQgY3VwcyBvZiBjb2ZmZWUgYSBkYXku|}
|> B64.decode;;
yields an error:
Exception: Invalid_argument "Base64.decode: wrong padding".
but
module B64 = Base64.Make(struct include Base64.Config_rfc4648 let ignore_newline = true end);;
{|RGV2ZWxvcGVyIHByb2R1Y3Rpdml0eSBpcyBt
ZWFzdXJlZCBpbiBjYWZmZWluZSBpbnRha2Uu
IFRoZSBtb3JlIGNvZmZlZSBhIGRldmVsb3Bl
ciBjb25zdW1lcywgdGhlIGhpZ2hlciBpcyB0
aGVpciBwcm9kdWN0aXZpdHkuIEl0J3MgcnVt
b3JlZCB0aGF0IGRldmVsb3BlcnMgYXQgR29v
Z2xlIGNvbnN1bWUgdXAgdG8gdHdvIGh1bmRy
ZWQgY3VwcyBvZiBjb2ZmZWUgYSBkYXku
|}
|> B64.decode;;
yields a result:
- : bytes = Bytes.of_string "Developer productivity is measured in caffeine intake. The more coffee a developer consumes, the higher is their productivity. It's rumored that developers at Google consume up to two hundred cups of coffee a day."
relevant error log (excerpt of https://github.com/kxcteam/kxclib-ocaml/actions/runs/4254986177/jobs/7402000342):
Full test results in `/__w/kxclib-ocaml/kxclib-ocaml/_build/default/unit_test/_build/_tests/Datecode_unit_tests'.
Test Successful in 0.007s. 111 tests run.
File "jsoo/unit_test/dune", line 17, characters 0-[122](https://github.com/kxcteam/kxclib-ocaml/actions/runs/4254986177/jobs/7402000342#step:9:123):
17 | (rule
18 | (action (run %{bin:node} %{deps}))
19 | ; (deps ./jsoo_unit_tests.js)
20 | (deps ./jsoo_unit_tests.bc.js)
21 | (alias runtest))
(cd _build/default/jsoo/unit_test && /usr/local/bin/node jsoo_unit_tests.bc.js)
/__w/kxclib-ocaml/kxclib-ocaml/_build/default/jsoo/unit_test/jsoo_unit_tests.bc.js:4379
throw err}
^
TypeError: runtime.caml_unix_gethostname is not a function
at gethostname (/__w/kxclib-ocaml/kxclib-ocaml/_build/default/jsoo/unit_test/jsoo_unit_tests.bc.js:47958:47)
at caml_call1 (/__w/kxclib-ocaml/kxclib-ocaml/_build/default/jsoo/unit_test/jsoo_unit_tests.bc.js:57139:28)
at /__w/kxclib-ocaml/kxclib-ocaml/_build/default/jsoo/unit_test/jsoo_unit_tests.bc.js:58905:10
at Object.<anonymous> (/__w/kxclib-ocaml/kxclib-ocaml/_build/default/jsoo/unit_test/jsoo_unit_tests.bc.js:62469:3)
at Module._compile (node:internal/modules/cjs/loader:[125](https://github.com/kxcteam/kxclib-ocaml/actions/runs/4254986177/jobs/7402000342#step:9:126)4:14)
at Module._extensions..js (node:internal/modules/cjs/loader:[130](https://github.com/kxcteam/kxclib-ocaml/actions/runs/4254986177/jobs/7402000342#step:9:131)8:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
module Config_rfc4648_relaxed = struct
include Config_rfc4648
let ignore_newline = true
end
を用意して、代りにこちらを include Make(Config_rfc4648_relaxed) しましょう
現在の ignore_newline
https://github.com/kxcteam/kxclib-ocaml/blob/ce6cf01df256cff329b28e52b8dc2a9eb8e72cb9/kxclib.ml#L2496-L2497 のかわりに、
(** white spaces : SP, LF, CR, HT, VT, FF;
line breaks : LF, CR;
NB that if [ignore_unknown] is set to true, then all white space characters are
automatically ignored *)
val ignore_whitespace : [
| `newlines_only (** only ignore LF and/or CR and white spaces immediately following *)
| `all_white_spaces (** ignore all white spaces *)
] option;
dune runtest
yarn test
under rescript
otherwise の関数版
'a option -> (unit -> 'a option) -> 'a option
が欲しい。
s/Kotoi-Xie Consultancy/Kotoi-Xie Consultancy, Inc\./g
s/kxc\.io/kxc\.inc/g
s/kxcteam\.com/kxc\.inc/g
it's currently very cumbersome to write int53p literals, thus we'd like to create a ppx helping this.
proposed syntax: 123p
.
semantics:
123
it as (Kxclib.Int53p.of_int 123)
12345678901p
it as (Kxclib.Int53p.of 12345678901L)
(-123p)
and (-12345678901L)
as wellInt.min/max
は OCaml 4.13 からなので,Bindoj で指定している OCaml 4.12 だと以下でビルドがコケます
File "vendors/kxclib/kxclib.ml", lines 1158-1174, characters 25-7:
1158 | .........................struct
1159 | let impl_flavor = `int_impl
1160 | include Int
1161 | module Ops = MakeOps(struct type int53p = int include Int end)
1162 | include Ops
...
1171 | let to_nativeint = Nativeint.of_int
1172 | let of_nativeint = Nativeint.to_int
1173 | [%%endif]
1174 | end
Error: Signature mismatch:
...
The value `max' is required but not provided
File "vendors/kxclib/kxclib.ml", line 1115, characters 4-40:
Expected declaration
The value `min' is required but not provided
File "vendors/kxclib/kxclib.ml", line 1114, characters 4-40:
Expected declaration
.. after which, reinstall matrix checks for 4.13.1 and 5.0.0 disabled here at a00e937
ref:
Line 1006 in f608f62
.. this is for different package dependency requirements for libs under jsoo, rescript, etc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.