Skip to content

Instantly share code, notes, and snippets.

@mads-hartmann
Created September 22, 2010 11:47
Show Gist options
  • Save mads-hartmann/591544 to your computer and use it in GitHub Desktop.
Save mads-hartmann/591544 to your computer and use it in GitHub Desktop.
// In a method that returns a NodeSeq.
// compiles
val seq = for {
moduleId <- S.param("moduleId")
moduleInstanceId <- S.param("id")
backupId <- S.param("backupId")
} yield bind("backup", xhtml, "path" -> backupId)
seq openOr (redirectTo("/"))
// doesn't compile
for {
moduleId <- S.param("moduleId")
moduleInstanceId <- S.param("id")
backupId <- S.param("backupId")
} yield {
bind("backup", xhtml, "path" -> backupId)
} openOr (redirectTo("/"))
// error
// [error] /Users/Mads/dev/projects/reverse_backup/productwebgui/src/main/scala/com/reversebackup/webgui/snippet/Backup.sc// ala:21: type mismatch;
// [error] found : net.liftweb.common.Box[String]
// [error] required: scala.xml.NodeSeq
// [error] moduleId <- S.param("moduleId")
// [error] ^
// [error] one error found
@teigen
Copy link

teigen commented Sep 22, 2010

// compiles
(for {
moduleId <- S.param("moduleId")
moduleInstanceId <- S.param("id")
backupId <- S.param("backupId")
} yield {
bind("backup", xhtml, "path" -> backupId)
}) openOr (redirectTo("/"))

@mads-hartmann
Copy link
Author

face-palm of course! :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment