Skip to content

Commit ec41e0f

Browse files
committed
fix bug in code sample for Stream.resource
1 parent 5b5075b commit ec41e0f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/elixir/lib/stream.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,14 +892,14 @@ defmodule Stream do
892892
893893
## Examples
894894
895-
Stream.resource(fn -> File.open("sample") end,
895+
Stream.resource(fn -> File.open!("sample") end,
896896
fn file ->
897897
case IO.read(file, :line) do
898898
data when is_binary(data) -> { data, file }
899899
_ -> nil
900900
end
901901
end,
902-
fn file -> File.close!(file) end)
902+
fn file -> File.close(file) end)
903903
904904
"""
905905
@spec resource((() -> acc), (acc -> { element, acc } | nil), (acc -> term)) :: Enumerable.t

0 commit comments

Comments
 (0)