Skip to content

Commit 233f824

Browse files
authored
Refine Enum.chunk_while/4 return type to [chunk] (#15552)
Unlike `chunk_by/2` and `chunk_every/2,4` (which always chunk into sublists and are typed `[list]`), `chunk_while/4` lets the reducer emit an arbitrary term as a chunk (`{:cont, chunk, acc}`, with `chunk: any`), so `[chunk]` is the precise return type.
1 parent a3bfe9d commit 233f824

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/elixir/lib/enum.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ defmodule Enum do
618618
acc,
619619
(element, acc -> {:cont, chunk, acc} | {:cont, acc} | {:halt, acc}),
620620
(acc -> {:cont, chunk, acc} | {:cont, acc})
621-
) :: Enumerable.t()
621+
) :: [chunk]
622622
when chunk: any
623623
def chunk_while(enumerable, acc, chunk_fun, after_fun) do
624624
{_, {res, acc}} =

0 commit comments

Comments
 (0)