Created
December 13, 2010 06:33
-
-
Save yuroyoro/738722 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // import ModelImplicitly._ | |
| // modelOf[AbstractReadOnlyModel].as{"foo"} | |
| object ModelImplicitly{ | |
| trait ModelBuilder[A[X] <: IModel[X]] { | |
| def as[B](f: => B): A[B] | |
| } | |
| implicit object AbstractReadOnlyModelBuilder extends | |
| ModelBuilder[AbstractReadOnlyModel]{ | |
| def as[B](f: => B) = new AbstractReadOnlyModel[B]{ | |
| def getObject = f | |
| } | |
| } | |
| def modelOf[A[B] <: IModel[B] :ModelBuilder]:ModelBuilder[A] = { | |
| implicitly[ModelBuilder[A]] | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment