Skip to content

Commit

Permalink
Refactor malformed docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
csgn committed Dec 30, 2024
1 parent be8d67f commit 59539ff
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 25 deletions.
35 changes: 21 additions & 14 deletions core/src/main/scala/lamda/Apply.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ object Apply {
implicit class ApplyOps[F[_], A](fa: F[A])(implicit F: Apply[F]) {
final def ap[B](ff: F[A => B]): F[B] = F.ap(fa)(ff)

/** @see
* Alias of [[lamda.Apply.ap]]
*
* Example:
/** Example:
* {{{
* scala> import lamda.syntax.apply._
* scala> import lamda.instances.option._
*
* scala> Option(1) <*> Option((x: Int) => x + 1)
* res0: Option[Int] = Some(2)
* }}}
*
* @see
* Alias of [[lamda.Apply.ap]]
*/
final def <*>[B](ff: F[A => B]): F[B] = F.ap(fa)(ff)

Expand All @@ -103,23 +103,30 @@ object Apply {

final def productL[B](fb: F[B]): F[A] = F.productL(fa, fb)

/** @see
* Alias of [[lamda.Apply.productR]]
*
* Example: {{{ scala> import lamda.syntax.apply._ scala> import
* lamda.instances.option._
/** Example:
* {{{
* scala> import lamda.syntax.apply._
* scala> import lamda.instances.option._
*
* scala> Option(1) *> Option(2) res0: Option[Int] = Option(2)
* }}}
*
* @see
* Alias of [[lamda.Apply.productR]]
*/
final def *>[B](fb: F[B]): F[B] = F.productR(fa, fb)

/** @see
* Alias of [[lamda.Apply.productL]]
/** Example:
* {{{
* scala> import lamda.syntax.apply._
* scala> import lamda.instances.option._
*
* Example: {{{ scala> import lamda.syntax.apply._ scala> import
* lamda.instances.option._
* scala> Option(1) <* Option(2)
* res0: Option[Int] = Some(1)
* }}}
*
* scala> Option(1) <* Option(2) res0: Option[Int] = Some(1)
* @see
* Alias of [[lamda.Apply.productL]]*
*/
final def <*[B](fb: F[B]): F[A] = F.productL(fa, fb)
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/lamda/Monoid.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ trait Monoid[T] extends Semigroup[T] {
* res0: Option[Int] = None
*
* scala> Monoid[String].empty
* res0: Int = ""
* res1: Int = ""
*
* scala> Monoid[Int].empty
* res0: Int = 0
* res2: Int = 0
* }}}
*/
def empty: T
Expand Down
25 changes: 16 additions & 9 deletions core/src/main/scala/lamda/Semigroup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,25 @@ object Semigroup {
implicit class SemigroupOps[T](a: T)(implicit F: Semigroup[T]) {
final def combine(b: T): T = F.combine(a, b)

/** @see
* Alias of [[lamda.Semigroup.combine]] scala> import
* lamda.syntax.semigroup._ scala> import lamda.instances.option._
* scala> import lamda.instances.int._ scala> import
* lamda.instances.string._
/** Example:
* {{{
* scala> import lamda.syntax.semigroup._
* scala> import lamda.instances.option._
* scala> import lamda.instances.int._
* scala> import lamda.instances.string._
*
* scala> Some(1) |+| Some(2) res0: Option[Int] = Some(3)
* scala> Some(1) |+| Some(2)
* res0: Option[Int] = Some(3)
*
* scala> Some("hello") |+| Some(" world") res1: Option[Int] = Some(hello
* world)
* scala> Some("hello") |+| Some(" world")
* res1: Option[Int] = Some(hello world)
*
* scala> "hello" |+| " world" res2: String = hello world
* scala> "hello" |+| " world"
* res2: String = hello world
* }}}
*
* @see
* Alias of [[lamda.Semigroup.combine]] *
*/
final def |+|(b: T): T = F.combine(a, b)
}
Expand Down

0 comments on commit 59539ff

Please sign in to comment.