@puffnfresh
Latest commit d04ab1f Jun 22, 2014 History
Tagged types were previously subtypes:

    A @@ T <: A

This is no longer the case since it caused a few bugs. For example, the
following compiled but give 5 as the result:

    scala> Monoid[Int].append(Tags.Multiplication(2), Tags.Multiplication(3))
    <console>:14: error: type mismatch;
     found   : scalaz.@@[Int,scalaz.Tags.Multiplication]
        (which expands to)  AnyRef{type Tag = scalaz.Tags.Multiplication; type Self = Int}
     required: Int
                  Monoid[Int].append(Tags.Multiplication(2), Tags.Multiplication(3))
                                                        ^

So now we have to manually unwrap our tags:

    scala> Monoid[Int @@ Tags.Multiplication].append(Tags.Multiplication(2), Tags.Multiplication(3))
    res1: scalaz.@@[Int,scalaz.Tags.Multiplication] = 6

    scala> Tag.unwrap(res1)
    res2: Int = 6

The unwrap gets inlined to just an `asInstanceOf` call, which is very
cheap.
15 contributors

Users who have contributed to this file

@S11001001 @larsrh @xuwei-k @retronym @tonymorris @runarorama @bmjames @wemrysi @puffnfresh @purefn @oxbowlakes @arjanblokzijl