Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactoring of imports and some changes in trait hierarchies

  • Loading branch information...
commit a7c1c0f2237c4738b641cec3644509577b41128b 1 parent 44282e7
Debasish Ghosh authored
View
5 src/main/scala/sjson/json/scalaz/Protocol.scala
@@ -26,8 +26,7 @@ trait Protocol {
implicit val StringFormat: Format[String]
}
-trait DefaultProtocol extends CollectionTypes with Generic with Primitives
-object DefaultProtocol extends DefaultProtocol {
+trait DefaultProtocol extends StandardTypes with Generic with Primitives {
import dispatch.json._
import Js._
@@ -62,3 +61,5 @@ object DefaultProtocol extends DefaultProtocol {
}
}
}
+
+object DefaultProtocol extends DefaultProtocol
View
2  src/main/scala/sjson/json/scalaz/StandardTypes.scala
@@ -45,7 +45,7 @@ trait BasicTypes extends Protocol {
</#list>
}
-trait CollectionTypes extends BasicTypes with Generic {
+trait CollectionTypes extends BasicTypes {
implicit def listFormat[T](implicit fmt : Format[T]) : Format[List[T]] = new Format[List[T]] {
def writes(ts: List[T]) = JsArray(ts.map(t => tojson(t)(fmt)))
View
1  src/test/scala/sjson/json/scalaz/Protocols.scala
@@ -9,7 +9,6 @@ import JsonSerialization._
import dispatch.json._
object Protocols {
-// package object z {
case class Address(no: Int, street: String, city: String, zip: String)
case class Person(lastName: String, firstName: String, age: Int, address: Address)
case class Contact(lastName: String, firstName: String, address: Address, officeCity: String, officeAddress: Address)
View
3  src/test/scala/sjson/json/scalaz/TypeclassSerializerSpec.scala
@@ -11,7 +11,6 @@ import Scalaz._
@RunWith(classOf[JUnitRunner])
class TypeclassSerializerSpec extends Spec with ShouldMatchers {
- import DefaultProtocol._
import JsonSerialization._
import Protocols._
@@ -45,6 +44,8 @@ class TypeclassSerializerSpec extends Spec with ShouldMatchers {
}
describe("Serialization of lists") {
+ import DefaultProtocol._
+
it ("should serialize list of Ints") {
val l1 = List(100, 200, 300, 400)
fromjson[List[Int]](tojson(l1)) should equal(l1.success)
Please sign in to comment.
Something went wrong with that request. Please try again.