File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 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) {
103103// Non-indexed reads -----------------------------------------------------------
104104//------------------------------------------------------------------------------
105105
106- exports [ "uncons'" ] = function ( empty ) {
106+ exports . unconsImpl = function ( empty ) {
107107 return function ( next ) {
108108 return function ( xs ) {
109109 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)
309309-- |
310310-- | Running time: `O(n)` where `n` is the length of the array
311311tail :: forall a . Array a -> Maybe (Array a )
312- tail = uncons' (const Nothing ) (\_ xs -> Just xs)
312+ tail = unconsImpl (const Nothing ) (\_ xs -> Just xs)
313313
314314-- | Get all but the last element of an array, creating a new array, or
315315-- | `Nothing` if the array is empty.
@@ -340,9 +340,9 @@ init xs
340340-- | Nothing -> somethingElse
341341-- | ```
342342uncons :: 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 }
344344
345- foreign import uncons'
345+ foreign import unconsImpl
346346 :: forall a b
347347 . (Unit -> b )
348348 -> (a -> Array a -> b )
@@ -1093,7 +1093,7 @@ unzip xs =
10931093-- | ```
10941094-- |
10951095foldM :: 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)
10971097
10981098foldRecM :: forall m a b . MonadRec m => (a -> b -> m a ) -> a -> Array b -> m a
10991099foldRecM f a array = tailRecM2 go a 0
You can’t perform that action at this time.
0 commit comments