Giter VIP home page Giter VIP logo

kxclib-ocaml's People

Contributors

cannorin avatar dependabot[bot] avatar haochenx avatar kxc-hongoh avatar kxc-ryfujis avatar kxc-wraikny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

cannorin anz-ryu

kxclib-ocaml's Issues

+Fn.gate & may_append

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 !!(@)

add Option.try_make : ?capture:(exn -> bool) -> (unit -> 'x) -> 'x option

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

Json.pp_unparse is buggy

{"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":
"利用規約が入る予定"}}

base64 decode padding check is inaccurate when input contains newlines

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."

fix ocaml.5.0.0 ci (jsoo test error)

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

make default base64 config ignore newline (and maybe also leading/trailing whitespaces) characters

方針

Default config について

https://github.com/kxcteam/kxclib-ocaml/blob/ce6cf01df256cff329b28e52b8dc2a9eb8e72cb9/kxclib.ml#L2730
の代りに、

module Config_rfc4648_relaxed = struct
  include Config_rfc4648
  let ignore_newline = true
end

を用意して、代りにこちらを include Make(Config_rfc4648_relaxed) しましょう

newline/whitespace config について

現在の 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;

add structural logging sub-system

wishlist (re. collection)

  • (at least simple) profiling
  • sub-tasking
  • mutable state logging
  • spinnable lifecycle tracking
  • auto categorizing with Format.format6
  • value structure aware logging
    • marshaling? sexp? jv?
  • scope (turn on/off)
  • severity/category (info, error, debug, etc.)
  • reference impl comparison

wishlist (replay / realtime debugging)

  • timeline playback with mutable state visualization
  • breakpoint; streaming debug info

法人化対応

  • s/Kotoi-Xie Consultancy/Kotoi-Xie Consultancy, Inc\./g
  • s/kxc\.io/kxc\.inc/g
  • s/kxcteam\.com/kxc\.inc/g

add ppx for int53p values

it's currently very cumbersome to write int53p literals, thus we'd like to create a ppx helping this.

proposed syntax: 123p.

semantics:

  • if the integer could be represented by int31, convert e.g. 123 it as (Kxclib.Int53p.of_int 123)
  • otherwise, convent e.g. 12345678901p it as (Kxclib.Int53p.of 12345678901L)
  • make sure handling (-123p) and (-12345678901L) as well

Does not build on OCaml 4.12

Int.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

re-enable matrix-check

  • for background, see c814654
    • the commit is part of #28
  • we need to properly deal with packaging and dependency management before re-enabling matrix check

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.