Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pomu0325
pomu0325 / GenTypeConstraints.scala
Created August 14, 2011 16:34 — forked from kmizu/GenTypeConstraints.scala
Hacking generalized type constraints.
object GenTypeConstraints {
abstract class =:=|[F,A,B] extends (F => Either[A,B])
object =:=| {
implicit def eqA[F,X]: =:=|[F,F,X] = new =:=|[F,F,X] {def apply(v:F) = Left(v)}
implicit def eqB[F,X]: =:=|[F,X,F] = new =:=|[F,X,F] {def apply(v:F) = Right(v)}
}
def main(args: Array[String]) {
println(f(1))
import java.util.Date
import java.text.SimpleDateFormat
import java.net.URL
import scala.xml._
import scala.xml.parsing.XhtmlParser
import scala.io.Source
case class User( userId:Int, nickname:String, twitterId:Option[String], join:Boolean = true )
class Event( eventId:String, eventXml:Node ) {
lazy val usersXml = XML.load( new URL( "http://api.atnd.org/events/users/?event_id=%s" format eventId ))