I've defined the following method:
def add(
prefix: List[String],
resourceName: String,
subTree: ResourceTree): ResourceTree = {
//import ResourceTreeInstances.semigroupInstance
implicit val dummyInstance = ResourceTreeInstances.semigroupInstance
// Make a resource tree with a single path.
def mkSinglePathRT(gPrefix: List[String]): ResourceTree = ???
this |+| mkSinglePathRT(prefix)
}
As you can see, I need to use the |+| method of Semigroup
, defined in the Cats library. I've defined an instance of Semigroup
for ResourceTree
, however, importing it using the commented import does not work (the |+|
operator is not found). Having the dummyInstance
above solves the problem, however this does not looks right.
Any idea about why the instance is not brought up by this import?