Search code examples
scalaakkaakka-stream

Unknown syntax used to describe Source for Akka-stream: "#Repr"


Quite new to Akka streams and I came across this piece of code the other day while at work. I'm not exactly sure what's going on here, and the developer who initially wrote this is long gone.

Can anyone here please shed some light on what the '#Repr[A]' snippet of code is actually doing.

Tried looking this up online but found nothing.

package models

import akka.stream.scaladsl.Source
import akka.util.ByteString
import models.CsvModels._

object CsvFileModels {
  type CsvSource = Source[ByteString,Any]#Repr[ByteString]#Repr[List[ByteString]]#Repr[Map[String, String]]
}

Compiles fine, just trying to figure out exactly what is going on here.


Solution

  • This is called type projection. It is somewhat equivalent to . in Java.

    I.e.

    Foo#Bar
    

    in Scala, is somewhat equivalent to

    Foo.Bar
    

    in Java.