scala - Type dependent implicits -
two implicits needed in function, can't have them in same parameter list, because dependent method type
. considered currying once more, gives me syntax error. what's correct way this?
def add[a](newannotations: seq[a]) (implicit maybeadd: maybeadd[l, seq[a]]) (implicit mod: modifier[maybeadd.out, seq[a], seq[a]]): slab[content, maybeadd.out] = { val l = maybeadd(annotations, seq[a]()) l.updatewith(_ ++ newannotations) }
i edited maybeadd
have aux
type, suggested @milessabin.
def add[a, out0](newannotations: seq[a])(implicit maybeadd: maybeadd.aux[l, seq[a], out0], mod: modifier[out0, seq[a], seq[a]]): slab[content, mod.out] = { val l = maybeadd(annotations, seq[a]()) new slab(content, mod(l, _ ++ newannotations)) }
Comments
Post a Comment