squiggle/packages/squiggle-lang/src/rescript/Utility/E/E_J.res
Umur Ozkul 5de73f171c E modules OCaml style
Huge E decomposed in to files
2022-09-11 21:52:25 +02:00

20 lines
426 B
Plaintext

module F = E_F
let toString = F.pipe(Js.Json.decodeString, E_O.default(""))
let fromString = Js.Json.string
let fromNumber = Js.Json.number
module O = {
let fromString = (str: string) =>
switch str {
| "" => None
| _ => Some(Js.Json.string(str))
}
let toString = (str: option<'a>) =>
switch str {
| Some(str) => Some(str |> F.pipe(Js.Json.decodeString, E_O.default("")))
| _ => None
}
}