tagged type wireformat

13 views
Skip to first unread message

Elliot Chow

unread,
Apr 21, 2013, 3:24:24 AM4/21/13
to scoobi...@googlegroups.com
Hi,

I am running into some issues with tagged types.  My guess right now is that the taggedTypeWireFormat in WireFormatImplicits is for shapeless tagged types, while I am trying to use scalaz tagged types.

For this code, I get "diverging implicit expansion":



import com.nicta.scoobi.Scoobi._

import scalaz.{DList => _, _}
import Scalaz._

object Test extends ScoobiApp{
  def run(){
    val dl = DList(Tags.Multiplication(1), Tags.Multiplication(2), Tags.Multiplication(3))
  }
}



If I exclude the implicit wireformat and create my own, it works fine:



import com.nicta.scoobi.Scoobi.{taggedTypeWireFormat => _, _}

import scalaz.{DList => _, _}
import Scalaz._

object Test2 extends ScoobiApp{
  def run(){
    implicit def scalazTaggedTypeWireFormat[T : WireFormat, U]: WireFormat[T @@ U] =
      implicitly[WireFormat[T]].asInstanceOf[WireFormat[T @@ U]]

    val dl = DList(Tags.Multiplication(1), Tags.Multiplication(2), Tags.Multiplication(3))
  }
}



What is the best way to deal with this?

Thanks.


Eric Torreborre

unread,
Apr 22, 2013, 12:36:17 AM4/22/13
to scoobi...@googlegroups.com
Hi Elliot,

I've solved your problem by embracing Scalaz (0.7.0) tagged types instead of Shapeless ones. We were actually only using Shapeless for this functionality so removing it reduces our complexity.

The new CDH3 snapshot should be published within the hour.

Cheers,

Eric.
Reply all
Reply to author
Forward
0 new messages