Skip to content

Commit

Permalink
Started using
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Jan 23, 2025
1 parent ed64620 commit fa6c4f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/xylophone.Xml.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object Xml:
def print(xml: Xml)(using XmlPrinter[Text]): Text = summon[XmlPrinter[Text]].print(xml)

def pathString(path: XmlPath): Text = if path.isEmpty then t"/" else path.map: value =>
(value: @unchecked) match
value.runtimeChecked match
case idx: Int => t"[$idx]"
case label: Text => t"/$label"
case unit: Unit => t"/*"
Expand Down Expand Up @@ -111,7 +111,7 @@ object Xml:
case elem@XmlAst.Element(_, _, _, _) => XmlDoc(XmlAst.Root(elem))

def normalize(xml: Xml): List[XmlAst] raises XmlAccessError =
def recur(path: XmlPath, current: List[XmlAst]): List[XmlAst] = (path: @unchecked) match
def recur(path: XmlPath, current: List[XmlAst]): List[XmlAst] = path.runtimeChecked match
case Nil =>
current

Expand Down
4 changes: 2 additions & 2 deletions src/core/xylophone.XmlDecoder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object XmlDecoder extends Derivation[XmlDecoder]:
if elements.length == 0 then raise(XmlReadError(), "".tt) else elements.head

given [ValueType](using decoder: Decoder[ValueType]): XmlDecoder[ValueType] = value =>
(value: @unchecked) match
value.runtimeChecked match
case XmlAst.Element(_, XmlAst.Textual(text) :: _, _, _) +: _ => text.decode[ValueType]

inline def join[DerivationType <: Product: ProductReflection]: XmlDecoder[DerivationType] = list =>
Expand All @@ -50,7 +50,7 @@ object XmlDecoder extends Derivation[XmlDecoder]:
context.read(List(element))

inline def split[DerivationType: SumReflection]: XmlDecoder[DerivationType] = list =>
(list.head: @unchecked) match
list.head.runtimeChecked match
case XmlAst.Element(_, children, attributes, _) =>
delegate(attributes.get(XmlName("type".tt)).get):
[VariantType <: DerivationType] => decoder =>
Expand Down

0 comments on commit fa6c4f9

Please sign in to comment.