Skip to content

Instantly share code, notes, and snippets.

@geelen
Created July 27, 2009 13:54
Show Gist options
  • Save geelen/156324 to your computer and use it in GitHub Desktop.
Save geelen/156324 to your computer and use it in GitHub Desktop.
import xml.{Node, Elem}
class Pluser(lhs : Unit => Seq[Node]) {
def ++(rhs : Unit => Seq[Node]) = (_ : Unit) => lhs() ++ rhs()
}
object Main {
implicit def hotString(s : Seq[Node]) = (_ : Unit) => s
implicit def pluser(lhs : Unit => Seq[Node]) = new Pluser(lhs)
def html(blk : Unit => Seq[Node]) = <html>{blk()}</html>
def body(blk : Unit => Seq[Node]) = (_ : Unit) => <body>{blk()}</body>
def head(blk : Unit => Seq[Node]) = (_ : Unit) => <head>{blk()}</head>
def title(s : String) = <title>{s}</title>
def main(args: Array[String]) {
println(html {
head {
title("Something")
} ++ body {
<p>lolfase</p>
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment