Skip to content

Instantly share code, notes, and snippets.

@sellmair
Last active May 10, 2018 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sellmair/817c5357b6ada71448bb9f9b039a595d to your computer and use it in GitHub Desktop.
Save sellmair/817c5357b6ada71448bb9f9b039a595d to your computer and use it in GitHub Desktop.
Phantom Types in Kotlin: Modelling a Pipeline: Request<Stage>
/*
* This is our Request type. It is basically a holder for all
* information we could wish from it. But we cannot read anything from it directly.
* It has a type param T.
* T is not used anywhere in Request directly, hence why it is called Phantom Type.
*/
class Request<T> (
private val image: Image?,
private val timestamp: Timestamp?,
private val measureSettings: MeasureSettings?,
private val preparedImage: Mat?,
private val scaledPreparedImage: Mat?,
private val shapes: List<Shape>?,
private val features: List<Feature>?,
private val people: List<Person>?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment