I take my first raid on a crag, transforming an existing class to use the Monoid trait. What I'm trying to achieve is to set the view to bind to my class type parameter, to make sure that it can only be used with types that can be implicitly converted to monoid. So my (simplified) class definition:
import scalaz._
import Scalaz._
case class Foo[T <% Monoid[T]](v: T)
new Foo(42)
Compiling this simple example gives a compiler error:
error: No implicit view available from Int => scalaz.Monoid[Int].
Previously, this rating was determined against my own custom attribute with an implicit conversion from T to property, and this worked fine.
What am I missing now, that I converted it to scalaz?
Thank you, Chris
source
share