Skip to content

Commit b35d232

Browse files
authored
Merge pull request #1234 from CakeML/more_sml_compatibility
More sml compatibility
2 parents 5204d42 + 69a8b11 commit b35d232

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

basis/mlbasicsProgScript.sml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,22 @@ Proof
9393
QED
9494

9595
Definition bool_toString_def:
96-
bool_toString b = if b then strlit "True" else strlit"False"
96+
bool_toString b = if b then strlit "True" else strlit "False"
97+
End
98+
99+
Definition bool_fromString_def:
100+
bool_fromString s = if s = strlit "True" then SOME T else
101+
if s = strlit "False" then SOME F else
102+
NONE
97103
End
98104

99105
val _ = ml_prog_update (open_module "Bool");
106+
val _ = (next_ml_names := ["not"]);
107+
val _ = trans "not" ``\x. ~x:bool``;
100108
val _ = (next_ml_names := ["toString"]);
101109
val _ = translate bool_toString_def;
110+
val _ = (next_ml_names := ["fromString"]);
111+
val _ = translate bool_fromString_def;
102112
val _ = (next_ml_names := ["compare"]);
103113
val _ = translate comparisonTheory.bool_cmp_def;
104114
val _ = ml_prog_update (close_module NONE);

basis/types.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ String.collate: (char -> char -> ordering) -> string -> string -> ordering
116116
String.char_escape_seq: char -> string option
117117
String.escape_str: string -> string
118118
String.escape_char: char -> string
119+
Bool.not: bool -> bool
119120
Bool.toString: bool -> string
121+
Bool.fromString: string -> bool option
120122
Bool.compare: bool -> bool -> ordering
121123
Pair.map: ('a -> 'b) -> ('c -> 'd) -> 'a * 'c -> 'b * 'd
122124
Pair.toString: ('a -> string) -> ('b -> string) -> 'a * 'b -> string

0 commit comments

Comments
 (0)