You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//>usingdepcom.lihaoyi::upickle:4.2.1importupickle.default.*traitDataTypeModule(valtypeName:String):typeT// evidence that T has a ReadWriter, defined in subtypesgivenreadWriterT:ReadWriter[T]
caseclassDataTyped(data: Data[T])
objectDataTyped:givenrw:ReadWriter[DataTyped] =
readwriter[ujson.Value].bimap[DataTyped](
// x => writeJs(x.data).obj.value.addOne("type" -> typeName),// replacing below line with one above hides the ambiguous error, causing hours of hunting
x => writeJs(x.data),
json =>DataTyped(read[Data[T]](json))
)
caseclassData[+A](value: A) derivesReadWriterobjectData:given [A:ReadWriter]:ReadWriter[Data[A]] =
readwriter[ujson.Value].bimap[Data[A]](
a => ujson.Obj("value"-> writeJs(a.value)),
json =>Data(read[A](json("value")))
)
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
3.7.0, 3.3.5, 3.3.6
Minimized code
Output (click arrow to expand)
The text was updated successfully, but these errors were encountered: