diff --git a/scratchpad/src/main/scala/com/htmlism/scratchpad/addresses.scala b/scratchpad/src/main/scala/com/htmlism/scratchpad/addresses.scala index 13797ca..a7f293e 100644 --- a/scratchpad/src/main/scala/com/htmlism/scratchpad/addresses.scala +++ b/scratchpad/src/main/scala/com/htmlism/scratchpad/addresses.scala @@ -11,9 +11,7 @@ class AbsoluteAddress(val n: Int, val alias: String) extends Address sealed trait ReadAddress[A] extends Address -sealed trait WriteAddress[A] extends Address: - def write[B: Loadable](x: B): syntax.PartiallyAppliedWrite[B, A] = - new syntax.PartiallyAppliedWrite(this, x) +sealed trait WriteAddress[A] extends Address trait Volatile[A] extends ReadAddress[A] diff --git a/scratchpad/src/main/scala/com/htmlism/scratchpad/syntax/package.scala b/scratchpad/src/main/scala/com/htmlism/scratchpad/syntax/package.scala index 5039ee2..b7ca2f2 100644 --- a/scratchpad/src/main/scala/com/htmlism/scratchpad/syntax/package.scala +++ b/scratchpad/src/main/scala/com/htmlism/scratchpad/syntax/package.scala @@ -1,6 +1,10 @@ package com.htmlism.scratchpad package object syntax: + implicit class WriteRegisterOps[A](reg: WriteAddress[A]): + def write[B: Loadable](x: B): syntax.PartiallyAppliedWrite[B, A] = + new syntax.PartiallyAppliedWrite(reg, x) + class PartiallyAppliedWrite[A: Loadable, B](reg: WriteAddress[B], x: A): def apply[C: Load: Store: Register]: String = val literal =