This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Snip */ | |
| test("Enum failure can be mapped to string", () => { | |
| let message = | |
| switch (Color.decode(jsonInvalidStr)) { | |
| | Belt.Result.Ok(result) => result->Belt.Result.Ok | |
| | Belt.Result.Error(parseError) => | |
| Decode_ParseError.toDebugString( | |
| x => | |
| switch (x) { | |
| | `InvalidColor => (_json => "Invalid color") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type selector('state, 'result) = 'state => 'result; | |
| [@bs.module "reselect"] | |
| external createSelector1: | |
| ('state => 'a, 'a => 'result) => selector('state, 'result) = | |
| "createSelector"; | |
| [@bs.module "reselect"] | |
| external createSelector2: | |
| ('state => 'a, 'state => 'b, ('a, 'b) => 'result) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open Relude.Globals; | |
| module ParseError = Decode.ParseError; | |
| module Decode = { | |
| let isValidDate: 'a => bool = [%raw | |
| {| | |
| function isValidDate(date) { | |
| return date && Object.prototype.toString.call(date) === "[object Date]" && !isNaN(date); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open Relude.Globals; | |
| [@bs.module "dotenv"] external getEnvVars: unit => unit = "config"; | |
| let getEnvVars = () => | |
| getEnvVars() | |
| |> (() => Node.Process.process##env) | |
| |> (Js.Dict.map((. x) => x |> Json.Encode.string) >> Json.Encode.dict); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open Relude.Globals; // I usually do this in bsconfig | |
| type user = { | |
| firstName: string, | |
| lastName: string, | |
| }; | |
| type error = | |
| | AlreadyLoggedIn; | |
| type context = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Error - 5:11:15 PM] Request textDocument/documentSymbol failed. | |
| Error: Connection got disposed. | |
| at Object.dispose (/Users/john/.vscode/extensions/ocamllabs.ocaml-platform-0.9.0/dist/index.js:26597:25) | |
| at Object.dispose (/Users/john/.vscode/extensions/ocamllabs.ocaml-platform-0.9.0/dist/index.js:14916:35) | |
| at LanguageClient.handleConnectionClosed (/Users/john/.vscode/extensions/ocamllabs.ocaml-platform-0.9.0/dist/index.js:17151:42) | |
| at LanguageClient.handleConnectionClosed (/Users/john/.vscode/extensions/ocamllabs.ocaml-platform-0.9.0/dist/index.js:34239:15) | |
| at closeHandler (/Users/john/.vscode/extensions/ocamllabs.ocaml-platform-0.9.0/dist/index.js:17138:18) | |
| at CallbackList.invoke (/Users/john/.vscode/extensions/ocamllabs.ocaml-platform-0.9.0/dist/index.js:7965:39) | |
| at Emitter.fire (/Users/john/.vscode/extensions/ocamllabs.ocaml-platform-0.9.0/dist/index.js:8024:36) | |
| at closeHandler (/Users/john/.vscode/extensions/ocamllabs.ocaml-platform-0.9.0/dist/index.js:25933:26) |
OlderNewer