Skip to content

Commit

Permalink
remove unused apply method from Castable, add codec to BaseOpaque
Browse files Browse the repository at this point in the history
  • Loading branch information
halotukozak committed Jul 16, 2024
1 parent b6a5b95 commit 2343fdd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ package com.avsystem.commons
package opaque

import com.avsystem.commons.opaque.Castable.<:>
import com.avsystem.commons.serialization.GenCodec

private[opaque] trait BaseOpaque[From] extends Castable.Ops {
trait Tag
type Type

implicit protected final val castable: From <:> Type = new Castable[From, Type]

def apply(value: From): Type


implicit protected final val castable: From <:> Type = new Castable[From, Type]
implicit final def codec(implicit fromCodec: GenCodec[From]): GenCodec[Type] = wrapF(fromCodec)
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.avsystem.commons
package opaque

private[opaque] final class Castable[A, B] {
@inline def apply(a: A): B = a.asInstanceOf[B]
}
private[opaque] final class Castable[A, B]
private[opaque] object Castable {
type <:>[A, B] = Castable[A, B]
def apply[A, B](implicit ev: A <:> B): Castable[A, B] = ev
Expand Down

0 comments on commit 2343fdd

Please sign in to comment.