Skip to content

Instantly share code, notes, and snippets.

@sgrove

sgrove/auth.re Secret

Last active July 23, 2017 23:43
Show Gist options
  • Save sgrove/76c9c674be8b6ec2ec353e7ed2e74921 to your computer and use it in GitHub Desktop.
Save sgrove/76c9c674be8b6ec2ec353e7ed2e74921 to your computer and use it in GitHub Desktop.
type authToken =
| OAuth string
| ApiKey string
[@@deriving yojson];
type auth =
| Google authToken
| Github authToken
[@@deriving yojson];
/* Error: Unbound constructor Google */
List.find
(
fun
| Google (OAuth token) => true
| Google (ApiKey token) => true
| Github (OAuth token) => false
| Github (ApiKey token) => false
)
parsedSession.auths;
/* Error: Unbound type constructor Auth.auth */
List.find
(
fun
| Google (OAuth token) => true
| Google (ApiKey token) => true
| Github (OAuth token) => false
| Github (ApiKey token) => false:
Auth.auth => bool
)
parsedSession.auths;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment