haskell: Phase 12 — Data.Set module wiring (import qualified Data.Set as Set)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 33s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 11:41:16 +00:00
parent 34513908df
commit 7ce0c797f3
4 changed files with 104 additions and 2 deletions

View File

@@ -1123,6 +1123,89 @@
(:else (hk-force d)))))
3))))))
(define
hk-bind-data-set!
(fn
(env alias)
(let
((p (str alias ".")))
(begin
(dict-set! env (str p "empty") hk-set-empty)
(dict-set!
env
(str p "singleton")
(hk-mk-lazy-builtin
"Set.singleton"
(fn (k) (hk-set-singleton (hk-force k)))
1))
(dict-set!
env
(str p "insert")
(hk-mk-lazy-builtin
"Set.insert"
(fn (k s) (hk-set-insert (hk-force k) (hk-force s)))
2))
(dict-set!
env
(str p "delete")
(hk-mk-lazy-builtin
"Set.delete"
(fn (k s) (hk-set-delete (hk-force k) (hk-force s)))
2))
(dict-set!
env
(str p "member")
(hk-mk-lazy-builtin
"Set.member"
(fn
(k s)
(hk-of-bool (hk-set-member (hk-force k) (hk-force s))))
2))
(dict-set!
env
(str p "size")
(hk-mk-lazy-builtin
"Set.size"
(fn (s) (hk-set-size (hk-force s)))
1))
(dict-set!
env
(str p "null")
(hk-mk-lazy-builtin
"Set.null"
(fn (s) (hk-of-bool (hk-set-null (hk-force s))))
1))
(dict-set!
env
(str p "union")
(hk-mk-lazy-builtin
"Set.union"
(fn (a b) (hk-set-union (hk-force a) (hk-force b)))
2))
(dict-set!
env
(str p "intersection")
(hk-mk-lazy-builtin
"Set.intersection"
(fn (a b) (hk-set-intersection (hk-force a) (hk-force b)))
2))
(dict-set!
env
(str p "difference")
(hk-mk-lazy-builtin
"Set.difference"
(fn (a b) (hk-set-difference (hk-force a) (hk-force b)))
2))
(dict-set!
env
(str p "isSubsetOf")
(hk-mk-lazy-builtin
"Set.isSubsetOf"
(fn
(a b)
(hk-of-bool (hk-set-is-subset-of (hk-force a) (hk-force b))))
2))))))
(define
hk-bind-decls!
(fn
@@ -1280,9 +1363,15 @@
(let
((modname (nth d 2)) (as-name (nth d 3)))
(let
((alias (cond ((nil? as-name) "Map") (:else as-name))))
((alias
(cond
((not (nil? as-name)) as-name)
((= modname "Data.Map") "Map")
((= modname "Data.Set") "Set")
(:else modname))))
(cond
((= modname "Data.Map") (hk-bind-data-map! env alias))
((= modname "Data.Set") (hk-bind-data-set! env alias))
(:else nil)))))
(:else nil)))
decls)