HS runtime: add Set/Map coercions to hs-coerce
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -355,6 +355,21 @@
|
|||||||
(list)
|
(list)
|
||||||
value)
|
value)
|
||||||
value))
|
value))
|
||||||
|
((= type-name "Set")
|
||||||
|
(if
|
||||||
|
(list? value)
|
||||||
|
(reduce
|
||||||
|
(fn
|
||||||
|
(acc x)
|
||||||
|
(if (some (fn (a) (= a x)) acc) acc (append acc (list x))))
|
||||||
|
(list)
|
||||||
|
value)
|
||||||
|
value))
|
||||||
|
((= type-name "Map")
|
||||||
|
(if
|
||||||
|
(dict? value)
|
||||||
|
(map (fn (k) (list k (get value k))) (keys value))
|
||||||
|
value))
|
||||||
(true value))))
|
(true value))))
|
||||||
|
|
||||||
(define
|
(define
|
||||||
|
|||||||
@@ -355,6 +355,21 @@
|
|||||||
(list)
|
(list)
|
||||||
value)
|
value)
|
||||||
value))
|
value))
|
||||||
|
((= type-name "Set")
|
||||||
|
(if
|
||||||
|
(list? value)
|
||||||
|
(reduce
|
||||||
|
(fn
|
||||||
|
(acc x)
|
||||||
|
(if (some (fn (a) (= a x)) acc) acc (append acc (list x))))
|
||||||
|
(list)
|
||||||
|
value)
|
||||||
|
value))
|
||||||
|
((= type-name "Map")
|
||||||
|
(if
|
||||||
|
(dict? value)
|
||||||
|
(map (fn (k) (list k (get value k))) (keys value))
|
||||||
|
value))
|
||||||
(true value))))
|
(true value))))
|
||||||
|
|
||||||
(define
|
(define
|
||||||
|
|||||||
Reference in New Issue
Block a user