In "Simply Lift" REST examples we can find
case Nil JsonGet _ => Item.inventoryItems: JValue
but
case Nil JsonPut Item(item) -> _ => Item.add(item): JValue
Why -> _ =>
instead of _ =>
? And what's that Nil
for?
In "Simply Lift" REST examples we can find
case Nil JsonGet _ => Item.inventoryItems: JValue
but
case Nil JsonPut Item(item) -> _ => Item.add(item): JValue
Why -> _ =>
instead of _ =>
? And what's that Nil
for?
This was a topic on the mailing list recently: Help understanding RestHelper serve params.
Basically, it is a series on unapply
methods written in infix style. This means it is equivalent to writing it
case JsonGet(Nil, _) => Item.inventoryItems: JValue
and
case JsonPut(Nil, Item(item) -> _) => Item.add(item): JValue // or
case JsonPut(Nil, Tuple2(Item(item), _)) => Item.add(item): JValue
// using that -> denotes a Tuple
which makes it appear a bit less voodoo.
© 2022 - 2024 — McMap. All rights reserved.