[Lift] Re: How do I create a function that takes MetaMappers?

2009-08-06 Thread Ross Mellgren

What complaint does the compiler have?

-Ross

On Aug 6, 2009, at 2:06 PM, jon wrote:


 I'd like to do something like

 def findAll[T : LongKeyedMapper[T],M : LongKeyedMetaMapper[T]]
 (metaObject: M): List[T] = {
   metaObject.findAll
 }

 val users:List[User] = findAll(User)
 val foos:List[Foo] = findAll(Foo)

 But the compiler won't have it.

 


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



[Lift] Re: How do I create a function that takes MetaMappers?

2009-08-06 Thread Naftoli Gugenheim

Pull M out as a type parameter and just declare the value parameter to be 
whatever M means.

-
Ross Mellgrendri...@gmail.com wrote:


What complaint does the compiler have?

-Ross

On Aug 6, 2009, at 2:06 PM, jon wrote:


 I'd like to do something like

 def findAll[T : LongKeyedMapper[T],M : LongKeyedMetaMapper[T]]
 (metaObject: M): List[T] = {
   metaObject.findAll
 }

 val users:List[User] = findAll(User)
 val foos:List[Foo] = findAll(Foo)

 But the compiler won't have it.

 




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



[Lift] Re: How do I create a function that takes MetaMappers?

2009-08-06 Thread jon

val users:List[User] = findAll(User)
-- inferred type arguments [Nothing,object com.x.lift.model.User] do
not conform to method findAll's type parameter bounds [T :
net.liftweb.mapper.LongKeyedMapper[T],M :
 net.liftweb.mapper.LongKeyedMetaMapper[T]]

if i change to:
val users:List[User] = findAll[User,User](User)
-- type arguments [com.x.lift.model.User,com.x.lift.model.User] do
not conform to method findAll's type parameter bounds [T :
net.liftweb.mapper.LongKeyedMapper[T],M :
 net.liftweb.mapper.LongKeyedMetaMapper[T]]

thanks,

jon

On Aug 6, 3:12 pm, Ross Mellgren dri...@gmail.com wrote:
 What complaint does the compiler have?

 -Ross

 On Aug 6, 2009, at 2:06 PM, jon wrote:





  I'd like to do something like

      def findAll[T : LongKeyedMapper[T],M : LongKeyedMetaMapper[T]]
  (metaObject: M): List[T] = {
        metaObject.findAll
      }

      val users:List[User] = findAll(User)
      val foos:List[Foo] = findAll(Foo)

  But the compiler won't have it.

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



[Lift] Re: How do I create a function that takes MetaMappers?

2009-08-06 Thread jon

Thanks Naftoli,

is this what you mean?

 def findAll[T : LongKeyedMapper[T]] (metaObject:
LongKeyedMetaMapper[T]): List[T] = {
   metaObject.findAll
 }
 **val users:List[User] = findAll[User](User)

still get **- type arguments [com.udorse.lift.model.User] do not
conform to method findAll's type parameter bounds [T :
net.liftweb.mapper.LongKeyedMapper[T]]

On Aug 6, 3:30 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Pull M out as a type parameter and just declare the value parameter to be 
 whatever M means.

 -

 Ross Mellgrendri...@gmail.com wrote:

 What complaint does the compiler have?

 -Ross

 On Aug 6, 2009, at 2:06 PM, jon wrote:





  I'd like to do something like

      def findAll[T : LongKeyedMapper[T],M : LongKeyedMetaMapper[T]]
  (metaObject: M): List[T] = {
        metaObject.findAll
      }

      val users:List[User] = findAll(User)
      val foos:List[Foo] = findAll(Foo)

  But the compiler won't have it.

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



[Lift] Re: How do I create a function that takes MetaMappers?

2009-08-06 Thread Ross Mellgren

Naftoli's suggestion is good, but I think your problem now is that  
User is not : LongKeyedMapper, it's : KeyedMapper. Here's one that  
compiles:

object Test {
 def findAll[T](m: KeyedMetaMapper[_, T]) = m.findAll

 def test {
 val users: List[User] = findAll(User)
 users
 }
}

On Aug 6, 2009, at 3:39 PM, jon wrote:


 Thanks Naftoli,

 is this what you mean?

 def findAll[T : LongKeyedMapper[T]] (metaObject:
 LongKeyedMetaMapper[T]): List[T] = {
   metaObject.findAll
 }
 **val users:List[User] = findAll[User](User)

 still get **- type arguments [com.udorse.lift.model.User] do not
 conform to method findAll's type parameter bounds [T :
 net.liftweb.mapper.LongKeyedMapper[T]]

 On Aug 6, 3:30 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Pull M out as a type parameter and just declare the value parameter  
 to be whatever M means.

 -

 Ross Mellgrendri...@gmail.com wrote:

 What complaint does the compiler have?

 -Ross

 On Aug 6, 2009, at 2:06 PM, jon wrote:





 I'd like to do something like

 def findAll[T : LongKeyedMapper[T],M : LongKeyedMetaMapper[T]]
 (metaObject: M): List[T] = {
   metaObject.findAll
 }

 val users:List[User] = findAll(User)
 val foos:List[Foo] = findAll(Foo)

 But the compiler won't have it.

 


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



[Lift] Re: How do I create a function that takes MetaMappers?

2009-08-06 Thread jon

excellent!

thank you both.

- jon

On Aug 6, 3:47 pm, Ross Mellgren dri...@gmail.com wrote:
 Naftoli's suggestion is good, but I think your problem now is that  
 User is not : LongKeyedMapper, it's : KeyedMapper. Here's one that  
 compiles:

 object Test {
      def findAll[T](m: KeyedMetaMapper[_, T]) = m.findAll

      def test {
          val users: List[User] = findAll(User)
          users
      }

 }

 On Aug 6, 2009, at 3:39 PM, jon wrote:





  Thanks Naftoli,

  is this what you mean?

      def findAll[T : LongKeyedMapper[T]] (metaObject:
  LongKeyedMetaMapper[T]): List[T] = {
        metaObject.findAll
      }
      **val users:List[User] = findAll[User](User)

  still get **- type arguments [com.udorse.lift.model.User] do not
  conform to method findAll's type parameter bounds [T :
  net.liftweb.mapper.LongKeyedMapper[T]]

  On Aug 6, 3:30 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
  Pull M out as a type parameter and just declare the value parameter  
  to be whatever M means.

  -

  Ross Mellgrendri...@gmail.com wrote:

  What complaint does the compiler have?

  -Ross

  On Aug 6, 2009, at 2:06 PM, jon wrote:

  I'd like to do something like

      def findAll[T : LongKeyedMapper[T],M : LongKeyedMetaMapper[T]]
  (metaObject: M): List[T] = {
        metaObject.findAll
      }

      val users:List[User] = findAll(User)
      val foos:List[Foo] = findAll(Foo)

  But the compiler won't have it.

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