Skip to content

Commit

Permalink
Clean code.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongl committed Sep 13, 2024
1 parent eb2f7a5 commit bc7c025
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
5 changes: 0 additions & 5 deletions src/core/Gauge.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,3 @@ object Gauge:
type BeatPerMinute = BeatPerMinute.type
type StepPerMinute = StepPerMinute.type
type Pace = Pace.type

trait Distance
trait Duration
trait Timestamp
trait Box
13 changes: 13 additions & 0 deletions src/core/Page.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package core


trait Page[A] extends (Mutation => Option[Mutation])

object Page:
given any: Page[EmptyTuple] = Some(_)

given tuple[H, T <: Tuple](using h: Page[H], t: Page[T]): Page[H *: T] =
a => h(a).flatMap(t)

def apply[A](using pa: Page[A]) = pa
end Page
13 changes: 4 additions & 9 deletions src/core/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@ extension [A](a: A) inline def single: NonEmpty[A] = a -> List.empty[A]
type Interval[A] = NonEmpty[A]
type History[A] = NonEmpty[Interval[A]]

trait Page[A] extends (Mutation => Option[Mutation])
object Page:
given any: Page[EmptyTuple] = Some(_)

given tuple[H, T <: Tuple](using h: Page[H], t: Page[T]): Page[H *: T] =
a => h(a).flatMap(t)

def apply[A](using pa: Page[A]) = pa
end Page
sealed trait Distance
sealed trait Duration
sealed trait Timestamp
sealed trait Box

type Injection[A] = (HTMLElement, A)
trait Inject[A] extends (Injection[A] => Unit):
Expand Down

0 comments on commit bc7c025

Please sign in to comment.