Closed eparejatobes closed 6 years ago
// is it worthwhile? import sums._ import products._ import functions._ import scala.Int type List[X] >: ∗ + (X × List[X]) <: ∗ + (X × List[X]) def head[X]: List[X] -> (∗ + X) = +-[∗] at left def tail[X]: List[X] -> (∗ + List[X]) = +-[∗] at right def Nil[X]: List[X] = inL at ∗ def cons[X]: (X × List[X]) -> List[X] = inR implicit class ListOps[X](xs: List[X]) { def ::(x: X): List[X] = cons(x and xs) } val l = 1 :: 2 :: 3 :: 4 :: Nil
Not worth the contortions, closing.