Skip to content

Commit

Permalink
[base] Add a description to <~, ~>, and <::> doccomments
Browse files Browse the repository at this point in the history
  • Loading branch information
rayrobdod committed Nov 28, 2024
1 parent d6760c6 commit 1b5a471
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Base/src/main/scala/Extractor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,17 @@ final class Extractor[Expr[_], Type[_], -A] private[stringContextParserCombinato
this.andThen(rhs)(ev)

/**
* Returns a parser which invokes this parser, and upon success invokes the other parser,
* discarding the Unit result from the other parser
* @group Sequence
* @since 0.1.1
*/
def <~(rhs:Extractor[Expr, Type, Unit]):Extractor[Expr, Type, A] =
this.andThen(rhs)(typeclass.ContraSequenced.genericUnit)

/**
* Returns a parser which invokes this parser, and upon success invokes the other parser,
* discarding the Unit result from this parser
* @group Sequence
* @since 0.1.1
*/
Expand Down
6 changes: 6 additions & 0 deletions Base/src/main/scala/Interpolator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,26 @@ final class Interpolator[-Expr, +A] private[stringContextParserCombinator] (
this.andThen(rhs)(ev)

/**
* Returns a parser which invokes this parser, and upon success invokes the other parser,
* discarding the Unit result from the other parser
* @group Sequence
* @since 0.1.1
*/
def <~[ExprZ <: Expr](rhs:Interpolator[ExprZ, Unit]):Interpolator[ExprZ, A] =
this.andThen(rhs)(typeclass.Sequenced.genericUnit)

/**
* Returns a parser which invokes this parser, and upon success invokes the other parser,
* discarding the Unit result from this parser
* @group Sequence
* @since 0.1.1
*/
def ~>[ExprZ <: Expr, B](rhs:Interpolator[ExprZ, B])(implicit ev: A <:< Unit):Interpolator[ExprZ, B] =
this.map(ev).andThen(rhs)(typeclass.Sequenced.unitGeneric)

/**
* Returns a parser which invokes this parser, and upon success invokes the other parser,
* prepending the result from this parser to the List result from the other parser
* @group Sequence
* @since 0.1.1
*/
Expand Down
4 changes: 4 additions & 0 deletions Base/src/main/scala/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,17 @@ final class Parser[Expr[_], Type[_], A] private[stringContextParserCombinator] (
this.andThen(rhs)(ev)

/**
* Returns a parser which invokes this parser, and upon success invokes the other parser,
* discarding the Unit result from the other parser
* @group Sequence
* @since 0.1.1
*/
def <~(rhs:Parser[Expr, Type, Unit]):Parser[Expr, Type, A] =
this.andThen(rhs)(typeclass.BiSequenced.genericUnit)

/**
* Returns a parser which invokes this parser, and upon success invokes the other parser,
* discarding the Unit result from this parser
* @group Sequence
* @since 0.1.1
*/
Expand Down

0 comments on commit 1b5a471

Please sign in to comment.