title: missing OptionMapper for join on custom mapped id types in slick 1.0
body: <p>TL;DR:  Why doesnt this compile?  <a href="https://github.com/refried/typedids-option-fk-issue" rel="nofollow">https://github.com/refried/typedids-option-fk-issue</a></p>
  
  <hr>
  
  <p>I'm using Slick to access an Oracle DB.  I've tried to implement custom ID types (e.g. UserID, AgencyID) for safer queries, in the style of cvogt's scaladays2013 example.  But when I attempt to do a join for a FK:</p>
  
  
  
  <pre class="lang-scala prettyprint-override"><code>package controllers
  
  import model._
  import scala.slick.session.Database.threadLocalSession
  import com.typesafe.slick.driver.oracle.OracleDriver.simple._
  
  
  object Auth {
    def auth(username: String, password: String): Boolean = {
      val q = for {
        (u,s) &lt;- User leftJoin Agency on (_.agencyId is _.id)
        if u.name.toLowerCase === username.toLowerCase.trim &amp;&amp; u.password === fn_hash(password)
      } yield (s.dataOutOfDate.?.getOrElse(false))
  
      db withSession {
        q.list.map {
          case (agencyOutOfDate) =&gt; !agencyOutOfDate
        }.headOption.getOrElse(false)
      }
    }
  }
  </code></pre>
  
  <p>I get an error I don't know how to resolve.</p>
  
  <pre class="lang-none prettyprint-override"><code>Auth.scala:11: Cannot perform option-mapped operation
  [error]       with type: (Option[model.AgencyId], model.AgencyId) =&gt; R
  [error]   for base type: (model.AgencyId, model.AgencyId) =&gt; Boolean
  [error]       (u,s) &lt;- User leftJoin Agency on (_.agencyId is _.id)
  </code></pre>
  
  <p>I didn't have any problem when I was using the same mapped ID type for all my columns:</p>
  
  <pre class="lang-scala prettyprint-override"><code>case class ID(bytes: Array[Byte]) extends AnyVal
  object ID {
    implicit val typemapper = MappedTypeMapper.base[ID,Array[Byte]](_.bytes, ID.apply)
  }
  </code></pre>
  
  <p>Although today, I am having trouble even reproducing / compiling that.  What am I missing?  Here's my model source:</p>
  
  <pre class="lang-scala prettyprint-override"><code>import play.api.db.DB
  import play.api.Play.current // implicit Application
  import scala.slick.lifted.MappedTypeMapper
  import com.typesafe.slick.driver.oracle.OracleDriver.simple._
  
  package object model {
    def db = Database.forDataSource(DB.getDataSource())
  
  
  /* Custom ID types */
    type RawID = Array[Byte]
    trait TypedId extends Any {
      def untypedId: RawID
      override def toString = untypedId.map("%02x" format _).mkString
    }
    case class AgencyId(untypedId: RawID) extends AnyVal with TypedId
    case class UserId(untypedId: RawID) extends AnyVal with TypedId
  
  
  /* Custom ID type mappers */
    sealed trait IdFactory[T &lt;: TypedId] extends (RawID =&gt; T)
  
    implicit object AgencyId        extends IdFactory[AgencyId]
    implicit object UserId          extends IdFactory[UserId]
  
    implicit def idMapper[T &lt;: TypedId : IdFactory]: TypeMapper[T] =
      MappedTypeMapper.base[T, RawID](_.untypedId, implicitly[IdFactory[T]])
  
  
  /* Tables &amp; Queries */
    case class User(id: Option[UserId] = None,
                    name: String,
                    password: String,
                    agencyId: Option[AgencyId] = None,
                    inactive: Boolean = false,
                    disabled: Boolean = true)
  
    object User extends Table[User]("USER") {
      def id = column[UserId]("ID", O.PrimaryKey)
      def name = column[String]("NAME")
      def password = column[String]("PASSWORD")
      def agencyId = column[Option[AgencyId]]("AGENCY_ID")//(typeMapperToOptionTypeMapper(idMapper(AgencyId)))
      def inactive = column[Boolean]("INACTIVE", O.Default(false))
      def disabled = column[Boolean]("IS_DISABLED", O.Default(true))
  
      def * = id.? ~ name ~ password ~ agencyId ~ inactive ~ disabled &lt;&gt; (User.apply _, User.unapply _)
  
      def agency = foreignKey("FK_TB_USER_AGENCY_ID",agencyId,Agency)(_.id.?)
    }
  
    case class Agency(id: Option[AgencyId] = None, name: String, dataOutOfDate: Boolean = false)
  
    object Agency extends Table[Agency]("AGENCY") {
      def id = column[AgencyId]("ID", O.PrimaryKey)
      def name = column[String]("NAME")
      def dataOutOfDate = column[Boolean]("IS_DATA_OUT_OF_DATE")
      def * = id.? ~ name ~ dataOutOfDate &lt;&gt; (Agency.apply _, Agency.unapply _)
    }
  
  
  /* Remote functions */
    val fn_hash = SimpleFunction.unary[String,String]("fn_hash")
  
  }
  </code></pre>
  
  <p>My extra Play application dependencies, although I don't think my issue is Play-specific:</p>
  
  <pre class="lang-scala prettyprint-override"><code>"com.typesafe.slick" %% "slick-extensions" % "1.0.0",
  "com.typesafe.play" %% "play-slick" % "0.3.3"
  </code></pre>
  
  <p>Many thanks in advance!</p>