X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.runtime%2Fscl%2FSetUtils.scl;fp=bundles%2Forg.simantics.scl.runtime%2Fscl%2FSetUtils.scl;h=00fa752157498ec7b5bf5656902fe96866d16352;hb=f6eb89f397489b840e674a460b4d6f0c7847666c;hp=0000000000000000000000000000000000000000;hpb=97872f96afc18f4cd5b959d869fed80cd92f6aa1;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.runtime/scl/SetUtils.scl b/bundles/org.simantics.scl.runtime/scl/SetUtils.scl new file mode 100644 index 000000000..00fa75215 --- /dev/null +++ b/bundles/org.simantics.scl.runtime/scl/SetUtils.scl @@ -0,0 +1,13 @@ +import "Prelude" +import "Set" as Set +import "MSet" as MSet +import "MList" as MList + +fromList :: [a] -> Set.T a +fromList l = runProc (MSet.freeze $ MSet.fromList l) + +toList :: Set.T a -> [a] +toList s = runProc do + result = MList.createC (Set.size s) + Set.iter (MList.add result) s + MList.freeze result \ No newline at end of file