How to max Box[CanBind] work

15 views
Skip to first unread message

Andreas Joseph Krogh

unread,
Apr 9, 2015, 9:56:39 AM4/9/15
to liftweb
Hi all.
 
I have this implicit to transform a OnMouseOver class:
 
case class OnMouseOver(cmd: JsCmd) extends SHtml.ElemAttr {
   def apply(in: Elem): Elem = in % ("onmouseover" -> cmd.toJsCmd)
}
object OnMouseOver {
   implicit def onMouseOverTransform: CanBind[OnMouseOver] = new CanBind[OnMouseOver] {
      def apply(str: => OnMouseOver)(ns: NodeSeq): Seq[NodeSeq] = {
         ns.collect {case e: Elem => str(e)}
      }
   }
}
 
Which may be used like this:
 
"^" #> OnMouseOver(tooltip)
 
But when using it with a Box :
 
"^" #> Full(OnMouseOver(tooltip))
 
The compiler complains:
 
Error: could not find implicit value for parameter computer: net.liftweb.util.CanBind[net.liftweb.common.Box[no.officenet.origo.frontend.lift.lib.OrigoElemAttrs.OnMouseOver]]
                    "^" #> Full(OnMouseOver(tooltip))
                                      ^
 
I thought anything which is a CanBind also could be used in a Box...
 
Any idea how to fix this without explicitly writing a CanBind[Box[OnMouseOver]] ?
 
Thanks.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963

Antonio Salazar Cardozo

unread,
Apr 9, 2015, 1:49:04 PM4/9/15
to lif...@googlegroups.com
Does Option work? I know there's Option support but can't remember for sure if there's
Box support out of the… Box! badum-ch
Thanks,
Antonio

Andreas Joseph Krogh

unread,
Apr 9, 2015, 3:11:15 PM4/9/15
to lif...@googlegroups.com
På torsdag 09. april 2015 kl. 19:49:04, skrev Antonio Salazar Cardozo <savedf...@gmail.com>:
Does Option work? I know there's Option support but can't remember for sure if there's
Box support out of the… Box! badum-ch
Thanks,
Antonio
 
Same error with Option.
 
So you're saying that if there exists for any T an implicit CanBind[T], then it should work for CanBind[Option[T]] ?
That surely isn't the case, or I'm doing something wrong...

Antonio Salazar Cardozo

unread,
Apr 16, 2015, 4:39:23 PM4/16/15
to lif...@googlegroups.com
I thought so? Could be that I'm wrong, though, I haven't checked the code to make sure.
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages