&, and CssBind vs. CssBindFunc

33 views
Skip to first unread message

Scott Morrison

unread,
Mar 6, 2011, 6:28:49 PM3/6/11
to lif...@googlegroups.com
I'm having trouble using the & operation on CssBind. When I write:

val inputFields = List("display-name", "email", "home-page")
val transforms = inputFields map (field => ("id=" + field) #>
SHtml.onSubmit(formData += field -> _))
transforms reduceLeft (_ & _)

I get a compile error: "type mismatch; found :
net.liftweb.util.CssBindFunc required: net.liftweb.util.CssBind". So
far, the only work around I've found is forgetting back to the level
of NodeSeq => NodeSeq, and using "andThen" instead of "&". Am I
missing some magic implicit transformation that would make this work?

val inputFields = List("display-name", "email", "home-page")
val transforms: List[NodeSeq => NodeSeq] = inputFields map (field =>
("id=" + field) #> SHtml.onSubmit(formData += field -> _))
transforms reduceLeft (_ andThen _)

thanks,
Scott Morrison

David Pollak

unread,
Mar 6, 2011, 7:04:41 PM3/6/11
to lif...@googlegroups.com
On Sun, Mar 6, 2011 at 3:28 PM, Scott Morrison <sc...@tqft.net> wrote:
I'm having trouble using the & operation on CssBind. When I write:

       val inputFields = List("display-name", "email", "home-page")
       val transforms = inputFields map (field => ("id=" + field) #>
SHtml.onSubmit(formData += field -> _))
       transforms reduceLeft (_ & _)

I get a compile error: "type mismatch;  found   :
net.liftweb.util.CssBindFunc  required: net.liftweb.util.CssBind". So
far, the only work around I've found is forgetting back to the level
of NodeSeq => NodeSeq, and using "andThen" instead of "&". Am I
missing some magic implicit transformation that would make this work?

transforms.reduceLeft[CssBind](_ & _)

Sometimes the type inferencer gets things not quite right.
 

       val inputFields = List("display-name", "email", "home-page")
       val transforms: List[NodeSeq => NodeSeq] = inputFields map (field =>
("id=" + field) #> SHtml.onSubmit(formData += field -> _))
       transforms reduceLeft (_ andThen _)

thanks,
Scott Morrison

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.




--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics

chka

unread,
Apr 8, 2011, 5:32:51 PM4/8/11
to Lift
transforms.reduceLeft[CssBind](_ & _) <--- Does it work?

I tried it, but still getting the same error message that says "type
mismatch;  found   : net.liftweb.util.CssBindFunc  required:
net.liftweb.util.CssBind".

Thanks,
Chka
> Beginning Scalahttp://www.apress.com/book/view/1430219890

David Pollak

unread,
Apr 8, 2011, 5:34:08 PM4/8/11
to lif...@googlegroups.com
On Fri, Apr 8, 2011 at 2:32 PM, chka <chi...@gmail.com> wrote:
transforms.reduceLeft[CssBind](_ & _) <--- Does it work?

I tried it, but still getting the same error message that says "type
mismatch;  found   : net.liftweb.util.CssBindFunc  required:
net.liftweb.util.CssBind".


Please upgrade to Lift 2.3, the type signatures changed between 2.2 and 2.3
 
Reply all
Reply to author
Forward
0 new messages