File tree 2 files changed +5
-5
lines changed
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ exports.snoc = function (l) {
103
103
// Non-indexed reads -----------------------------------------------------------
104
104
//------------------------------------------------------------------------------
105
105
106
- exports [ "uncons'" ] = function ( empty ) {
106
+ exports . unconsImpl = function ( empty ) {
107
107
return function ( next ) {
108
108
return function ( xs ) {
109
109
return xs . length === 0 ? empty ( { } ) : next ( xs [ 0 ] ) ( xs . slice ( 1 ) ) ;
Original file line number Diff line number Diff line change @@ -309,7 +309,7 @@ last xs = xs !! (length xs - 1)
309
309
-- |
310
310
-- | Running time: `O(n)` where `n` is the length of the array
311
311
tail :: forall a . Array a -> Maybe (Array a )
312
- tail = uncons' (const Nothing ) (\_ xs -> Just xs)
312
+ tail = unconsImpl (const Nothing ) (\_ xs -> Just xs)
313
313
314
314
-- | Get all but the last element of an array, creating a new array, or
315
315
-- | `Nothing` if the array is empty.
@@ -340,9 +340,9 @@ init xs
340
340
-- | Nothing -> somethingElse
341
341
-- | ```
342
342
uncons :: forall a . Array a -> Maybe { head :: a , tail :: Array a }
343
- uncons = uncons' (const Nothing ) \x xs -> Just { head: x, tail: xs }
343
+ uncons = unconsImpl (const Nothing ) \x xs -> Just { head: x, tail: xs }
344
344
345
- foreign import uncons'
345
+ foreign import unconsImpl
346
346
:: forall a b
347
347
. (Unit -> b )
348
348
-> (a -> Array a -> b )
@@ -1093,7 +1093,7 @@ unzip xs =
1093
1093
-- | ```
1094
1094
-- |
1095
1095
foldM :: forall m a b . Monad m => (a -> b -> m a ) -> a -> Array b -> m a
1096
- foldM f a = uncons' (\_ -> pure a) (\b bs -> f a b >>= \a' -> foldM f a' bs)
1096
+ foldM f a = unconsImpl (\_ -> pure a) (\b bs -> f a b >>= \a' -> foldM f a' bs)
1097
1097
1098
1098
foldRecM :: forall m a b . MonadRec m => (a -> b -> m a ) -> a -> Array b -> m a
1099
1099
foldRecM f a array = tailRecM2 go a 0
You can’t perform that action at this time.
0 commit comments