Skip to content

Commit 8882669

Browse files
committed
applied suggestions
1 parent 6567bb8 commit 8882669

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/Data/Array/ST.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ exports.popImpl = function (just) {
3232
return function (nothing) {
3333
return function (xs) {
3434
return function () {
35-
return xs.length ? just(xs.pop()) : nothing;
35+
return xs.length > 0 ? just(xs.pop()) : nothing;
3636
};
3737
};
3838
};
@@ -50,7 +50,7 @@ exports.shiftImpl = function (just) {
5050
return function (nothing) {
5151
return function (xs) {
5252
return function () {
53-
return xs.length ? just(xs.shift()) : nothing;
53+
return xs.length > 0 ? just(xs.shift()) : nothing;
5454
};
5555
};
5656
};

src/Data/Array/ST.purs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ sort = sortBy compare
9191
shift :: forall h a. STArray h a -> ST h (Maybe a)
9292
shift = shiftImpl Just Nothing
9393

94-
foreign import shiftImpl :: forall h a. (a -> Maybe a) -> Maybe a -> STArray h a -> ST h (Maybe a)
94+
foreign import shiftImpl
95+
:: forall h a
96+
. (forall b. b -> Maybe b)
97+
-> (forall b. Maybe b)
98+
-> STArray h a
99+
-> ST h (Maybe a)
95100

96101
-- | Sort a mutable array in place using a comparison function.
97102
sortBy
@@ -150,7 +155,12 @@ foreign import poke :: forall h a. Int -> a -> STArray h a -> ST h Boolean
150155
pop :: forall h a. STArray h a -> ST h (Maybe a)
151156
pop = popImpl Just Nothing
152157

153-
foreign import popImpl :: forall h a. (a -> Maybe a) -> Maybe a -> STArray h a -> ST h (Maybe a)
158+
foreign import popImpl
159+
:: forall h a
160+
. (forall b. b -> Maybe b)
161+
-> (forall b. Maybe b)
162+
-> STArray h a
163+
-> ST h (Maybe a)
154164

155165
-- | Append an element to the end of a mutable array. Returns the new length of
156166
-- | the array.

0 commit comments

Comments
 (0)