Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 类型参数中“::”的含义?_Scala_Shapeless - Fatal编程技术网

Scala 类型参数中“::”的含义?

Scala 类型参数中“::”的含义?,scala,shapeless,Scala,Shapeless,查看Travis Brown关于的优秀博客文章,我看到了以下方法: implicit def hconsParser[H: Parser, T <: HList: Parser]: Parser[H :: T] = new Parser[H :: T] { def apply(s: String): Option[H :: T] = s.split(",").toList match { case cell +: rest => f

查看Travis Brown关于的优秀博客文章,我看到了以下方法:

  implicit def hconsParser[H: Parser, T <: HList: Parser]: Parser[H :: T] =           
   new Parser[H :: T] {
    def apply(s: String): Option[H :: T] = s.split(",").toList match {
      case cell +: rest => for {
        head <- implicitly[Parser[H]].apply(cell)
        tail <- implicitly[Parser[T]].apply(rest.mkString(","))
      } yield head :: tail
    }
  }
implicit def-hconsParser[H:Parser,T代表{

head
H::T
是类型
:[H,T]
的中缀形式,它是一个
HList
,头为
H
,尾为
T
scala> trait infix[A, B]

scala> def test[A, B](ab: A infix B) = ???
test: [A, B](ab: infix[A,B])Nothing