From 344d3223955649bef245ec6094d205d3cbca13df Mon Sep 17 00:00:00 2001 From: Jon Pretty Date: Wed, 24 Jan 2024 19:41:20 +0100 Subject: [PATCH] Use updated Symbolism typeclasses --- src/text/text.scala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/text/text.scala b/src/text/text.scala index ff7183e..72605c1 100644 --- a/src/text/text.scala +++ b/src/text/text.scala @@ -35,16 +35,17 @@ object Anticipation: def apply(string: String): Text = string extension (text: Text) inline def s: String = text - given add: ClosedOperator["+", Text] = _+_ + given addOperator: AddOperator[Text, Text] with + type Result = Text + inline def add(left: Text, right: Text): Text = (left.s+right.s).tt - given times: Operator["*", Text, Int] with + given mulOperator: MulOperator[Text, Int] with type Result = Text private def recur(text: Text, n: Int, acc: Text): Text = if n == 0 then acc else recur(text, n - 1, acc+text) - inline def apply(left: Text, right: Int): Text = - recur(left, right.max(0), "") + inline def mul(left: Text, right: Int): Text = recur(left, right.max(0), "") given ordering: Ordering[Text] = Ordering.String.on[Text](identity) given fromString: CommandLineParser.FromString[Text] = identity(_)