-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22642ea
commit b054aac
Showing
3 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Generated by ReScript, PLEASE EDIT WITH CARE | ||
|
||
|
||
function fromStringExn(param) { | ||
switch (param) { | ||
case "false" : | ||
return false; | ||
case "true" : | ||
return true; | ||
default: | ||
throw { | ||
RE_EXN_ID: "Invalid_argument", | ||
_1: "Bool.fromStringExn: value is neither \"true\" nor \"false\"", | ||
Error: new Error() | ||
}; | ||
} | ||
} | ||
|
||
function fromString(param) { | ||
switch (param) { | ||
case "false" : | ||
return false; | ||
case "true" : | ||
return true; | ||
default: | ||
return ; | ||
} | ||
} | ||
|
||
function xor(a, b) { | ||
return a !== b; | ||
} | ||
|
||
function xnor(a, b) { | ||
return a === b; | ||
} | ||
|
||
function nand(a, b) { | ||
return !(a && b); | ||
} | ||
|
||
function nor(a, b) { | ||
return !(a || b); | ||
} | ||
|
||
export { | ||
fromStringExn , | ||
fromString , | ||
xnor , | ||
xor , | ||
nand , | ||
nor , | ||
} | ||
/* No side effect */ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Core__Bool.res | ||
external compare: (bool, bool) => Core__Ordering.t = "%compare" | ||
|
||
external equal: (bool, bool) => bool = "%equal" | ||
|
||
@send external toString: bool => string = "toString" | ||
|
||
let fromStringExn = param => | ||
switch param { | ||
| "true" => true | ||
| "false" => false | ||
| _ => raise(Invalid_argument(`Bool.fromStringExn: value is neither "true" nor "false"`)) | ||
} | ||
|
||
let fromString = param => | ||
switch param { | ||
| "true" => Some(true) | ||
| "false" => Some(false) | ||
| _ => None | ||
} | ||
|
||
external and_: (bool, bool) => bool = "%sequand" | ||
|
||
external or: (bool, bool) => bool = "%sequor" | ||
|
||
external not: bool => bool = "%boolnot" | ||
|
||
let xor = (a, b) => a !== b | ||
|
||
let xnor = (a, b) => !xor(a, b) | ||
|
||
let nand = (a, b) => !and_(a, b) | ||
|
||
let nor = (a, b) => !or(a, b) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
external compare: (bool, bool) => Core__Ordering.t = "%compare" | ||
|
||
external equal: (bool, bool) => bool = "%equal" | ||
|
||
@send external toString: bool => string = "toString" | ||
|
||
let fromStringExn: string => bool | ||
|
||
let fromString: string => option<bool> | ||
|
||
external and_: (bool, bool) => bool = "%sequand" | ||
|
||
external or: (bool, bool) => bool = "%sequor" | ||
|
||
external not: bool => bool = "%boolnot" | ||
|
||
let xnor: (bool, bool) => bool | ||
|
||
let xor: (bool, bool) => bool | ||
|
||
let nand: (bool, bool) => bool | ||
|
||
let nor: (bool, bool) => bool |