Skip to content

Commit 3ce07be

Browse files
committed
builtin: add Map.Bytes
1 parent c131249 commit 3ce07be

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/par/builtin/Builtin.par

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ type Map<k, v> = iterative choice {
367367
}
368368

369369
dec Map.String : [type v] [List<(String) box v>] Map<String, v>
370+
dec Map.Bytes : [type v] [List<(Bytes) box v>] Map<Bytes, v>
370371
dec Map.Int : [type v] [List<(Int) box v>] Map<Int, v>
371372
dec Map.Nat : [type v] [List<(Nat) box v>] Map<Nat, v>
372373

src/par/builtin/map.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ pub fn external_module() -> Module<Arc<process::Expression<()>>> {
3434
),
3535
|handle| Box::pin(map_new(handle, Handle::string, Handle::provide_string)),
3636
),
37+
// Map.Bytes : [type v] [List<(Bytes) box v>] Map<Bytes, v>
38+
Definition::external(
39+
"Bytes",
40+
Type::forall(
41+
"v",
42+
Type::function(
43+
Type::name(
44+
Some("List"),
45+
"List",
46+
vec![Type::pair(Type::bytes(), Type::box_(Type::var("v")))],
47+
),
48+
Type::name(None, "Map", vec![Type::bytes(), Type::var("v")]),
49+
),
50+
),
51+
|handle| Box::pin(map_new(handle, Handle::bytes, Handle::provide_bytes)),
52+
),
3753
// Map.Int : [type v] [List<(Int) box v>] Map<Int, v>
3854
Definition::external(
3955
"Int",

0 commit comments

Comments
 (0)