diff options
Diffstat (limited to 'stdlib/source/library/lux/data/collection/dictionary.lux')
-rw-r--r-- | stdlib/source/library/lux/data/collection/dictionary.lux | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index ef8f4f75d..124adeceb 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -690,52 +690,52 @@ (empty key_hash) keys))) -(implementation: .public (equivalence (open ",#[0]")) +(def: .public (equivalence (open ",#[0]")) (All (_ k v) (-> (Equivalence v) (Equivalence (Dictionary k v)))) - - (def: (= reference subject) - (and (n.= (..size reference) - (..size subject)) - (list.every? (function (_ [k rv]) - (case (..value k subject) - {.#Some sv} - (,#= rv sv) - - _ - #0)) - (..entries reference))))) - -(implementation: node_functor + (implementation + (def: (= reference subject) + (and (n.= (..size reference) + (..size subject)) + (list.every? (function (_ [k rv]) + (case (..value k subject) + {.#Some sv} + (,#= rv sv) + + _ + #0)) + (..entries reference)))))) + +(def: node_functor (All (_ k) (Functor (Node k))) - - (def: (each f fa) - (case fa - {#Hierarchy size hierarchy} - {#Hierarchy size (array.each (each f) hierarchy)} - - {#Base bitmap base} - {#Base bitmap (array.each (function (_ either) - (case either - {.#Left fa'} - {.#Left (each f fa')} - - {.#Right [k v]} - {.#Right [k (f v)]})) - base)} - - {#Collisions hash collisions} - {#Collisions hash (array.each (function (_ [k v]) - [k (f v)]) - collisions)}))) - -(implementation: .public functor + (implementation + (def: (each f fa) + (case fa + {#Hierarchy size hierarchy} + {#Hierarchy size (array.each (each f) hierarchy)} + + {#Base bitmap base} + {#Base bitmap (array.each (function (_ either) + (case either + {.#Left fa'} + {.#Left (each f fa')} + + {.#Right [k v]} + {.#Right [k (f v)]})) + base)} + + {#Collisions hash collisions} + {#Collisions hash (array.each (function (_ [k v]) + [k (f v)]) + collisions)})))) + +(def: .public functor (All (_ k) (Functor (Dictionary k))) - - (def: (each f fa) - (.revised #root (at ..node_functor each f) fa))) + (implementation + (def: (each f fa) + (.revised #root (at ..node_functor each f) fa)))) -(implementation: .public (monoid hash) +(def: .public (monoid hash) (All (_ k v) (-> (Hash k) (Monoid (Dictionary k v)))) - - (def: identity (..empty hash)) - (def: composite ..composite)) + (implementation + (def: identity (..empty hash)) + (def: composite ..composite))) |