최신 Reason/OCaml과 함께 Rescript에서 `let.opt` 사용
(let.opt
) 정의입니다.let (let.opt) = (x, f) =>
switch (x) {
| None => None
| Some(x) => f(x)
};
let (and.opt) = (a, b) =>
switch (a, b) {
| (Some(a), Some(b)) => Some((a, b))
| _ => None
};
let z = (a,b)=> {
let.opt a = a
and.opt b = b;
Some(a + b);
};
이것은
[email protected]
의 Rescript 파일입니다.//Demo.res
let a = Some(10);
let b = Some(3);
Js.log2("using ocaml 4.12 compiled reasonml let.opt in Rescript", Opts.z(a,b));
여기 요점이 있습니다.
실행할 수 있는 프로젝트는 다음과 같습니다.
<사업부 클래스="readme-개요">
idkjs / letop-rescript
rescript에서 (let.opt) 스타일 사용
자원: https://github.com/ocaml/ocaml/pull/1947
멜란지: https://github.com/melange-re/melange
Rescript: https://rescript-lang.org/
디스코드: https://discord.gg/KAJBzYaf
Reference
이 문제에 관하여(최신 Reason/OCaml과 함께 Rescript에서 `let.opt` 사용), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/idkjs/using-let-opt-in-rescript-with-latest-reason-ocaml-531n텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)