Skip to content

Commit df8778e

Browse files
committed
fixup! fixup! Stop old #:: from being called
docs
1 parent 4f842eb commit df8778e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

core/src/main/scala-2.13+/cats/data/NonEmptyLazyList.scala

+20-1
Original file line numberDiff line numberDiff line change
@@ -81,27 +81,46 @@ object NonEmptyLazyList extends NonEmptyLazyListInstances {
8181
def apply[A](a: => A, as: A*): NonEmptyLazyList[A] =
8282
create(a #:: LazyList.from(as))
8383

84-
// allows the creation of fully lazy `NonEmptyLazyList`s by prepending to this
84+
/**
85+
* Wraps a `LazyList` that may or may not be empty so that individual
86+
* elements or `NonEmptyLazyList`s can be prepended to it to construct a
87+
* result that is guaranteed not to be empty without evaluating any elements.
88+
*/
8589
def maybe[A](ll: => LazyList[A]): Maybe[A] = new Maybe(() => ll)
8690

91+
/**
92+
* Wrapper around a `LazyList` that may or may not be empty so that individual
93+
* elements or `NonEmptyLazyList`s can be prepended to it to construct a
94+
* result that is guaranteed not to be empty without evaluating any elements.
95+
*/
8796
final class Maybe[A] private[NonEmptyLazyList] (mkLL: () => LazyList[A]) {
8897
// because instances of this class are created explicitly, they might be
8998
// reused, and we don't want to re-evaluate `mkLL`
9099
private[this] lazy val ll = mkLL()
91100

101+
/** Prepends a single element, yielding a `NonEmptyLazyList`. */
92102
def #::[AA >: A](elem: => AA): NonEmptyLazyList[AA] =
93103
create(elem #:: ll)
104+
105+
/** Prepends a `LazyList`, yielding another [[Maybe]]. */
94106
def #:::[AA >: A](prefix: => LazyList[AA]): Maybe[AA] =
95107
new Maybe(() => prefix #::: ll)
108+
109+
/** Prepends a `NonEmptyLazyList`, yielding a `NonEmptyLazyList`. */
96110
def #:::[AA >: A](prefix: => NonEmptyLazyList[AA])(implicit d: DummyImplicit): NonEmptyLazyList[AA] =
97111
create(prefix.toLazyList #::: ll)
98112
}
99113

100114
final class Deferrer[A] private[NonEmptyLazyList] (private val nell: () => NonEmptyLazyList[A]) extends AnyVal {
115+
/** Prepends a single element. */
101116
def #::[AA >: A](elem: => AA): NonEmptyLazyList[AA] =
102117
create(elem #:: nell().toLazyList)
118+
119+
/** Prepends a `LazyList`. */
103120
def #:::[AA >: A](prefix: => LazyList[AA]): NonEmptyLazyList[AA] =
104121
create(prefix #::: nell().toLazyList)
122+
123+
/** Prepends a `NonEmptyLazyList`. */
105124
def #:::[AA >: A](prefix: => NonEmptyLazyList[AA])(implicit d: DummyImplicit): NonEmptyLazyList[AA] =
106125
create(prefix.toLazyList #::: nell().toLazyList)
107126
}

0 commit comments

Comments
 (0)