title: Slick/Scala: What is a Rep[Bind] and how do I turn it into a value?
body: <p>I'm trying to figure out Slick (the Scala functional relational model). I've started to build a prototype in Slick 3.0.0 but of course... most of the documentation is either out of date or incomplete.</p>
  
  <p>I've managed to get to a point where I can create a schema and return an object from the database.</p>
  
  <p>The problem is, what I'm getting back is a "Rep[Bind]" and not the object I would expect to get back. I can't figure out what to do this this value. For instance, if I try something like rep.countDistinct.result, I get a crash.</p>
  
  <p>Here's a quick synopsis of the code... some removed for brevity:</p>
  
  <pre><code>class UserModel(tag: Tag) extends Table[User](tag, "app_dat_user_t") {
      def id = column[Long]("n_user_id", O.PrimaryKey)
      def created = column[Long]("d_timestamp_created")
  
      def * = (id.?, created) &lt;&gt; (User.tupled, User.unapply)
  }
  
  case class User(id: Option[Long], created: Long)
  
  val users = TableQuery[UserModel]
  
  (users.schema).create
  
  db.run(users += User(Option(1), 2))
  
  println("ID is ... " + users.map(_.id)) // prints "Rep[Bind]"... huh?
  
  val users = for (user &lt;- users) yield user
  
  println(users.map(_.id).toString) // Also prints "Rep[Bind]"...
  </code></pre>
  
  <p>I can't find a way to "unwrap" the Rep object and I can't find any clear explanation of what it is or how to use it.</p>