Skip to content

Commit

Permalink
Fix documentation PT2
Browse files Browse the repository at this point in the history
  • Loading branch information
geirolz committed Dec 14, 2022
1 parent 5c20592 commit f54d2a7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
20 changes: 10 additions & 10 deletions core/src/main/scala/cats/xml/cursor/Cursor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@ sealed trait Cursor[+X <: Xml] extends Serializable {
type Focus

/** Apply the current cursor to the specified input. This allows to select a precise part of the
* [[Xml]] tree.
* `Xml` tree.
*
* The method is pure and return a Left when the focusing fails
* @param input
* target of the cursor
* @return
* [[Right]] when succeed [[Left]] when fail
* `Right` when succeed `Left` when fail
*/
def focus(input: XmlNode): Cursor.Result[X]

/** Create a [[FreeCursor]] which represent a cursor with a free `T` type as result of the
* focusing, this implies that a `Decoder` instance is need to convert the fixed `Xml` type of
* the `Cursor` to the free `T` type of the [[FreeCursor]].
/** Create a `FreeCursor` which represent a cursor with a free `T` type as result of the focusing,
* this implies that a `Decoder` instance is need to convert the fixed `Xml` type of the `Cursor`
* to the free `T` type of the `FreeCursor`.
*
* So, practically speaking, when the [[FreeCursor]] is applied this [[Cursor]] is applied and
* the result is decoded using the specified [[Decoder]] for type `T`.
* So, practically speaking, when the `FreeCursor` is applied this `Cursor` is applied and the
* result is decoded using the specified `Decoder` for type `T`.
*
* @tparam T
* free type in which decode the current cursor result
* @return
* A new [[FreeCursor]]
* A new `FreeCursor`
*/
def as[T: Decoder]: FreeCursor[Xml, T] =
FreeCursor[T](this)

/** A string representation of the cursor.
/** A String representation of the cursor.
*
* @return
* a [[String]] which represent the cursor path
* a String which represent the cursor path
*/
def path: String

Expand Down
22 changes: 11 additions & 11 deletions core/src/main/scala/cats/xml/cursor/FreeCursor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ import cats.xml.{Xml, XmlNode}
import cats.xml.codec.{Decoder, DecoderFailure}
import cats.xml.validator.Validator

/** [[FreeCursor]] represent a cursor with a free `O` type as result of the focusing and a free `I`
/** `FreeCursor` represent a cursor with a free `O` type as result of the focusing and a free `I`
* type as target of the focusing.
*
* @tparam I
* Input type of the [[FreeCursor]]
* Input type of the `FreeCursor`
* @tparam O
* Output type of the [[FreeCursor]]
* Output type of the `FreeCursor`
*/
sealed trait FreeCursor[I, +O] extends Serializable { $this =>

/** Apply the current cursor to the specified input of type `I`. This allows to select a precise
* part of the input `I` tree.
*
* The method is pure and return a [[Left]] when the focusing fails
* The method is pure and return a `Left` when the focusing fails
*
* @param input
* target of the cursor
* @return
* [[Right]] when succeed [[Left]] when fail
* `Right` when succeed `Left` when fail
*/
def focus(input: I): FreeCursor.Result[O]

Expand All @@ -35,20 +35,20 @@ sealed trait FreeCursor[I, +O] extends Serializable { $this =>
* @tparam U
* Type of mapped value
* @return
* A new [[FreeCursor]] which once applied, apply this cursor and then if succeed apply the
* A new `FreeCursor` which once applied, apply this cursor and then if succeed apply the
* function `f` in order to map the result
*/
def map[U](f: O => U): FreeCursor[I, U] =
FreeCursor.of($this.focus(_).map(f))

/** Create a new [[FreeCursor]] where the output of this cursor is validated with the specified
* [[Validator]]
/** Create a new `FreeCursor` where the output of this cursor is validated with the specified
* `Validator`
* @param validator
* [[Validator]] instance to validate the output of this cursor
* `Validator` instance to validate the output of this cursor
* @tparam OO
* Output type of the new validated [[FreeCursor]]
* Output type of the new validated `FreeCursor`
* @return
* A new validated [[FreeCursor]]
* A new validated `FreeCursor`
*/
def validate[OO >: O](validator: Validator[OO]): FreeCursor[I, OO] =
FreeCursor.of((input: I) =>
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/scala/cats/xml/xmlNode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ sealed trait XmlNodeSyntax {

implicit class XmlNodeCursorOps(node: XmlNode) {

/** Build and apply a [[Cursor]] to this [[XmlNode]] instance.
/** Build and apply a `Cursor` to this `XmlNode` instance.
* @param f
* function to build the cursor
* @tparam X
Expand All @@ -645,11 +645,11 @@ sealed trait XmlNodeSyntax {
def focus[X <: Xml](f: NodeCursor.Root.type => Cursor[X]): Cursor.Result[X] =
f(Root).focus(node)

/** Build and apply a [[FreeCursor]] to this [[XmlNode]] instance.
/** Build and apply a `FreeCursor` to this `XmlNode` instance.
*
* @param f
* function to build the cursor
* @tparam X
* @tparam T
* type of the focusing output
* @return
* Cursor result, Left when fails Right when succeed
Expand Down

0 comments on commit f54d2a7

Please sign in to comment.