Skip to content

Commit

Permalink
Reformat with scalafmt 3.8.3
Browse files Browse the repository at this point in the history
Executed command: scalafmt --non-interactive
  • Loading branch information
scala-steward committed Dec 31, 2024
1 parent 1b97317 commit 0f14682
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
5 changes: 2 additions & 3 deletions scautable/js/src/jsSpecific.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package io.github.quafadas.scautable

trait PlatformSpecific {

/**
* With scaladoc
/** With scaladoc
*/
def shouldTotallyAppearInDocs(): Unit = ()

}
}
11 changes: 6 additions & 5 deletions scautable/jvm/src/jvmSpecific.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ trait PlatformSpecific {
runtime.exec(Array[String](s"""xdg-open $uri]"""))
}

/**
* Attempts to open a browser window, and display this Seq of `Product` as a table.
/** Attempts to open a browser window, and display this Seq of `Product` as a table.
*
* @param a - seq of case classes
* @param tableDeriveInstance - summon a HtmlTableRender instance for the case class
* @param a
* \- seq of case classes
* @param tableDeriveInstance
* \- summon a HtmlTableRender instance for the case class
* @return
*/
def desktopShow[A <: Product](a: Seq[A])(using tableDeriveInstance: HtmlTableRender[A]) = {
Expand Down Expand Up @@ -70,4 +71,4 @@ $$(document).ready( function () {
// val asString = scautable(a).toString()
// kernel.publish.html(asString)

}
}
64 changes: 32 additions & 32 deletions scautable/src/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -309,40 +309,40 @@ object scautable extends PlatformSpecific {
tr(elemLabels.map(th(_)))

protected inline def deriveCaseClass[A](using m: Mirror.ProductOf[A]) =
new HtmlTableRender[A] {

override def tableHeader(a: A) =
val elemLabels = getElemLabels[m.MirroredElemLabels]
tr(elemLabels.map(th(_)))

override def tableCell(a: A) = ???

override def tableRow(a: A) = {
val elemLabels = getElemLabels[m.MirroredElemLabels]
val elemInstances = getTypeclassInstances[m.MirroredElemTypes]
val elems =
a.asInstanceOf[Product].productIterator // every case class implements scala.Product, we can safely cast here
val elemCells = elems
.zip(elemInstances)
.map { (elem, instance) =>
instance.tableCell(elem)
}
.toList
tr(
elemCells
)
}
new HtmlTableRender[A] {

override def tableHeader(a: A) =
val elemLabels = getElemLabels[m.MirroredElemLabels]
tr(elemLabels.map(th(_)))

override def tableCell(a: A) = ???

override def tableRow(a: A) = {
val elemLabels = getElemLabels[m.MirroredElemLabels]
val elemInstances = getTypeclassInstances[m.MirroredElemTypes]
val elems =
a.asInstanceOf[Product].productIterator // every case class implements scala.Product, we can safely cast here
val elemCells = elems
.zip(elemInstances)
.map { (elem, instance) =>
instance.tableCell(elem)
}
.toList
tr(
elemCells
)
}
}

/** Render a sequence of unknown type as an html table
*
* @param a
* \- A sequence of unknown type you wish to render as an html table
* @param addHeader
* \- If true, add a header row to the table
* @param tableDeriveInstance
* \- An instance of HtmlTableRender for the type `A`
*/
/** Render a sequence of unknown type as an html table
*
* @param a
* \- A sequence of unknown type you wish to render as an html table
* @param addHeader
* \- If true, add a header row to the table
* @param tableDeriveInstance
* \- An instance of HtmlTableRender for the type `A`
*/
def apply[A <: Product](a: Seq[A], addHeader: Boolean = true)(using tableDeriveInstance: HtmlTableRender[A]): TypedTag[String] =
val h = a.head.productElementNames.toList
val header = tr(h.map(th(_)))
Expand Down

0 comments on commit 0f14682

Please sign in to comment.