Skip to content

Commit 64e6037

Browse files
committed
Fixed doc typos in Inspect.Algebra
1 parent 8a9927e commit 64e6037

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

lib/elixir/lib/inspect/algebra.ex

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ defmodule Inspect.Algebra do
1818
iex> Inspect.Algebra.pretty(doc, 80)
1919
"foo"
2020
21-
The functions `nest/2`, `space/2` and `line/2` helps you put the
21+
The functions `nest/2`, `space/2` and `line/2` help you put the
2222
document together into a rigid structure. However, the document
2323
algebra gets interesting when using functions like `break/2`, which
24-
converts the given string into a line break depending on much space
24+
converts the given string into a line break depending on how much space
2525
there is to print. Let's glue two docs together with a break and then
2626
render it:
2727
@@ -30,28 +30,28 @@ defmodule Inspect.Algebra do
3030
"a b"
3131
3232
Notice the break was represented as is, because we haven't reached
33-
a line limit. Once we do, it is replaced by a new line:
33+
a line limit. Once we do, it is replaced by a newline:
3434
3535
iex> doc = Inspect.Algebra.glue(String.duplicate("a", 20), " ", "b")
3636
iex> Inspect.Algebra.pretty(doc, 10)
3737
"aaaaaaaaaaaaaaaaaaaa\nb"
3838
3939
Finally, this module also contains Elixir related functions, a bit
40-
tied up to Elixir formatting, namely `surround/3` and `surround_many/5`.
40+
tied to Elixir formatting, namely `surround/3` and `surround_many/5`.
4141
4242
## Implementation details
4343
4444
The original Haskell implementation of the algorithm by [Wadler][1]
4545
relies on lazy evaluation to unfold document groups on two alternatives:
46-
`:flat` (breaks as spaces) and `:broken` (breakes as newlines).
47-
Implementing the same logic on a strict language such as Elixir leads
48-
to an exponential growth of the possible documents, unless document
46+
`:flat` (breaks as spaces) and `:broken` (breaks as newlines).
47+
Implementing the same logic in a strict language such as Elixir leads
48+
to an exponential growth of possible documents, unless document
4949
groups are encoded explictly as `:flat` or `:broken`. Those groups are
5050
then reduced to a simple document, where the layout is already decided,
5151
per [Lindig][0].
5252
5353
Custom pretty printers can be implemented using the documents returned
54-
by this module and by providing its own rendenring functions.
54+
by this module and by providing their own rendering functions.
5555
5656
[0]: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.2200
5757
[1]: http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf
@@ -76,7 +76,7 @@ defmodule Inspect.Algebra do
7676
defrecordp :doc_group, :doc_group, [doc: :doc_nil]
7777

7878
@doc """
79-
Returns :doc_nil which is a document entity used to represent
79+
Returns `:doc_nil` which is a document entity used to represent
8080
nothingness. Takes no arguments.
8181
8282
## Examples
@@ -109,7 +109,7 @@ defmodule Inspect.Algebra do
109109
def concat(docs), do: folddoc(docs, concat(&1, &2))
110110

111111
@doc """
112-
Nests document entity x positions deep. Nesting will be
112+
Nests document entity `x` positions deep. Nesting will be
113113
appended to the line breaks.
114114
115115
## Examples
@@ -132,12 +132,12 @@ defmodule Inspect.Algebra do
132132
133133
Let's glue two docs together with a break and then render it:
134134
135-
iex> doc = Inspect.Algebra.glue("a", " ", "b")
136-
iex> Inspect.Algebra.pretty(doc, 80)
137-
"a b"
135+
iex> doc = Inspect.Algebra.glue("a", " ", "b")
136+
iex> Inspect.Algebra.pretty(doc, 80)
137+
"a b"
138138
139139
Notice the break was represented as is, because we haven't reached
140-
a line limit. Once we do, it is replaced by a new line:
140+
a line limit. Once we do, it is replaced by a newline:
141141
142142
iex> doc = Inspect.Algebra.glue(String.duplicate("a", 20), " ", "b")
143143
iex> Inspect.Algebra.pretty(doc, 10)
@@ -157,8 +157,8 @@ defmodule Inspect.Algebra do
157157
def glue(x, y), do: concat(x, concat(break, y))
158158

159159
@doc """
160-
Inserts a break, passed as second argument, between two docs,
161-
the first and the third argument.
160+
Inserts a break, passed as the second argument, between two docs,
161+
the first and the third arguments.
162162
"""
163163
@spec glue(doc, binary, doc) :: :doc_cons_t
164164
def glue(x, g, y) when is_binary(g), do: concat(x, concat(break(g), y))
@@ -243,7 +243,7 @@ defmodule Inspect.Algebra do
243243
@doc %B"""
244244
Surrounds a document with characters.
245245
246-
Puts the document between left and right enclosing and nests it.
246+
Puts the document between left and right enclosing and nesting it.
247247
The document is marked as a group, to show the maximum as possible
248248
concisely together.
249249
@@ -261,8 +261,8 @@ defmodule Inspect.Algebra do
261261

262262
@doc %B"""
263263
Maps and glues a collection of items together using the given separator
264-
and surround them. A limit can be passed which, once reached, stops
265-
glueing and outputs "..." instead.
264+
and surrounds them. A limit can be passed which, once reached, stops
265+
gluing and outputs "..." instead.
266266
267267
## Examples
268268
@@ -335,7 +335,7 @@ defmodule Inspect.Algebra do
335335

336336
@doc """
337337
The pretty printing function.
338-
Takes maximum width and a document to print as its arguments and returns the string
338+
Takes the maximum width and a document to print as its arguments and returns the string
339339
representation of the best layout for the document to fit in the given width.
340340
"""
341341
@spec pretty(doc, non_neg_integer) :: binary

0 commit comments

Comments
 (0)