| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (LiskovTest.scala)

This example Scala source code file (LiskovTest.scala) is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Scala by Example" TM.

Learn more about this Scala project at its project page.

Java - Scala tags/keywords

anyref, co1, co1_2, co2_2, contra1_2, contra2_2, liskovtest, speclite, unit

The LiskovTest.scala Scala example source code

package scalaz

object LiskovTest extends SpecLite {

  trait Co1[+ _]

  trait Contra1[- _]

  trait Co1_2[+A, B]

  trait Co2_2[A, +B]

  trait Contra1_2[-A, B]

  trait Contra2_2[A, -B]

  import Liskov._

  "apply" in {
    implicitly[String <:< AnyRef].apply(""): AnyRef

  "lift" in {
    def foo[A, B](implicit ev: A <~< B) {[Co1, A, B](ev)
      Liskov.contra[Contra1, A, B](ev)

      Liskov.co2[Co1_2, B, A, Unit](ev)
      Liskov.co2_2[Co2_2, B, Unit, A](ev)
      Liskov.contra1_2[Contra1_2, B, A, Unit](ev)
      Liskov.contra2_2[Contra2_2, B, Unit, A](ev)

    foo[String, AnyRef]


Other Scala examples (source code examples)

Here is a short list of links related to this Scala LiskovTest.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.