From: Hannu Niemistö Date: Fri, 3 Nov 2017 15:08:20 +0000 (+0200) Subject: (refs #7597) Allow side-effects in the function given to indexBy X-Git-Tag: v1.31.0~60 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F93%2F1193%2F2;p=simantics%2Fplatform.git (refs #7597) Allow side-effects in the function given to indexBy Change-Id: Id1f7f257b4b91dbcb47cea1d0f15350a1956ab17 --- diff --git a/bundles/org.simantics.scl.runtime/scl/Prelude.scl b/bundles/org.simantics.scl.runtime/scl/Prelude.scl index 5e5bd858b..6acbf924b 100644 --- a/bundles/org.simantics.scl.runtime/scl/Prelude.scl +++ b/bundles/org.simantics.scl.runtime/scl/Prelude.scl @@ -1949,7 +1949,7 @@ importJava "org.simantics.scl.runtime.Lists" where Given a list of values and a function computing a key for each value, the function produces a function that finds a value effeciently for the given key. """ - indexBy :: (a -> b) -> [a] -> b -> Maybe a + indexBy :: (a -> b) -> [a] -> (b -> Maybe a) "Works like `index` but uses the given functions as hash codes and equality." indexWith :: (a -> Integer) -> (a -> a -> Boolean) -> [(a,b)] -> a -> Maybe b