File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change 43
43
44
44
for_ :: forall a b f m. (Functor m, Applicative m, Foldable f) => f a -> (a -> m b) -> m { }
45
45
46
+ lookup :: forall a b f. (Eq a, Foldable f) => a -> f (Tuple a b) -> Maybe b
47
+
46
48
mconcat :: forall f m. (Foldable f, Monoid m) => f m -> m
47
49
48
50
notElem :: forall a f. (Eq a, Foldable f) => a -> f a -> Prim.Boolean
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import Data.Either
6
6
import Data.Eq
7
7
import Data.Maybe
8
8
import Data.Monoid
9
+ import Data.Monoid.First
9
10
import Data.Tuple
10
11
11
12
class Foldable f where
@@ -97,6 +98,9 @@ find :: forall a f. (Foldable f) => (a -> Boolean) -> f a -> Maybe a
97
98
find p f = case foldMap (\x -> if p x then [x] else [] ) f of
98
99
(x:_) -> Just x
99
100
[] -> Nothing
101
+
102
+ lookup :: forall a b f . (Eq a , Foldable f ) => a -> f (Tuple a b ) -> Maybe b
103
+ lookup a f = runFirst $ foldMap (\(Tuple a' b) -> First (if a == a' then Just b else Nothing )) f
100
104
101
105
foreign import foldrArray
102
106
" function foldrArray(f) {\
You can’t perform that action at this time.
0 commit comments